The first is the output string with a format specifier (%ld), while the next argument returns the sizeof value. In the final out | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The first is the output string with a format specifier (%ld), while the next argument returns the sizeof value. In the final out

What does this mean can anyone Please Explain. The first is the output string with a format specifier (%ld), while the next argument returns the sizeof value. In the final output, the %ld (for long decimal) is replaced by the value in the second argument.

8th Oct 2020, 8:56 AM
Emdad Ullah
Emdad Ullah - avatar
2 Answers
+ 5
It explains how this line works: printf("%ld", sizeof(int)); sizeof is an operator, it takes 1 variable or data type and returns the size of it. In other words, it returns how many bytes can the data type hold. The value it returns is an unsigned int, and the code prints the value. Just note that this code might reduce warnings of implicitly conversions because sizeof returns unsigned int, while %ld expects a long int.
8th Oct 2020, 9:43 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
printf or scanf require two arguments first in double quotes indecate type and size of the second argument value that will be displayed or inputed from user ,separated by comma printf("%d",number);
8th Oct 2020, 9:40 AM
HBhZ_C
HBhZ_C - avatar