answersLogoWhite

0

AllQ&AStudy Guides
Best answer

printf: format string + value list

scanf: format string + address list

This answer is:
Related answers

printf: format string + value list

scanf: format string + address list

View page

empty format-string.

View page

The syntax for printf is:

int printf(const char *format, ...);

Simple usage examples:

1. Print character literal: printf("%c", 'a');

2. Print character variable: printf("%c", my_char);

3. Print string literal: printf("%s", "hello world");

4. Print string variable: printf("%s", my_string);

5. Print integer variable: printf("%d", my_integer);

6. Print floating-point variable: printf("%f", my_float);

View page

%<width>.<precision>f

View page

You can certainly do that ...

printf ("This is a number: 12345\n");

... but that does not have the same value as placing the value in a variable and converting the variable into a string ...

int i = 12345;

printf ("This is a number: %d\n", i);

That's the whole point of format specifiers - to initiate a conversion from one place to another.

View page
Featured study guide

How do you get Froslass in diamond

How did the KKK get money

How do you tell people you dont want to be friends anymore

Learning English and studying English for a academic purposes

➡️
See all cards
2.71
7 Reviews
More study guides
3.5
2 Reviews

3.95
39 Reviews
Search results