| Specifier | Meaning | Example |
|---|---|---|
| %d | Integer (decimal) | printf("%d", 10); |
| %f | Floating point (decimal) | printf("%f", 3.14); |
| %c | Single character | printf("%c", 'A'); |
| %s | String (text) | printf("%s", "Hi"); |
#include <stdio.h>
int main() {
int variable_1 = 10;
float variable_2 = 10.20;
printf("d");
printf("\n");
printf("%d", variable_1);
printf("\n");
printf("%d d", variable_1);
printf("\n");
printf("%d d - %f f", variable_1, variable_2);
printf("\n");
printf("Lorem ipsum %d. Lorem ipsum %f. Lorem ipsum %.2f.", variable_1, variable_2, variable_2);
return 0;
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.