Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Printf syntax in C language printf("%d %d %c\n ",a, b, c); And printf ("%d% d% c \ n ",&; First, & ampb & amp;; c); What is the difference? Must adopt
Printf syntax in C language printf("%d %d %c\n ",a, b, c); And printf ("%d% d% c \ n ",&; First, & ampb & amp;; c); What is the difference? Must adopt
First look at the declaration of printf function.

int? printf? (? const? Charles? *? Format? ...? );

Print? Format? Data? Where to? Standard output

Writing? That? c? String? Sharp? By who? Format? Where to? That? Standard? Output? (stdout)。 ? What if? Format? Including? Format? Descriptor? (subsequence? Start? With what? %),? That? Additional? Arguing? Follow? Format? Is it? Format? And then what? Insert? Are you online? That? And the result? String? Replace? Their? Respectively? Descriptor.

What is the format of the first parameter? Represents the output format? Among them? %d? Represents an integer output. %c? Show? Output of type char

The following parameters correspond to the format preceded by%.

printf("%d? %d? %c\n ",a,b,c); Show? Answer? B output in shaping output mode and C output in character format.

This symbol & amp means reference when defining a variable, and means taking the address of this variable when passing parameters and assigning values.

printf("%d? %d? %c\n ",& i, & ampb & amp;; c); Show? Answer? The address of the b variable is output by shaping? The address of the c variable is output in character format.

This kind of output is definitely wrong. Addresses are usually output in %p format.