Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Newcomers begin to learn C language by themselves, but they don't understand one question: question 1:printf("%d ",123) and printf( 123).
Newcomers begin to learn C language by themselves, but they don't understand one question: question 1:printf("%d ",123) and printf( 123).
Printf("%d with semicolon ("%d", 123) is a correct statement and can output decimal integer data123; Printf( 123) is an error statement even if it is followed by a plus sign, and it can't even pass compilation. Printf can directly output strings, such as printf ("123"); Print the string123 on the screen; There must be formatting control string parameters when outputting other types of data, otherwise an error will occur, such as printf (123); It will go wrong because the compiler doesn't know what it is. Therefore, printf("%d ",123) and printf( 123) are not comparable.