0

Please explain me about the working of above code

I want to know about %ld and working of sizeof as well as about code given

1st May 2021, 5:50 PM
Muhammad Faisal
Muhammad Faisal - avatar
12 Respuestas
+ 1
Post your code?
1st May 2021, 5:50 PM
Atul [Inactive]
+ 1
#include <stdio.h> int main() { printf("int: %ld \n", sizeof(int)); printf("float: %ld \n", sizeof(float)); printf("double: %ld \n", sizeof(double)); printf("char: %ld \n", sizeof(char)); return 0; }
1st May 2021, 5:54 PM
Muhammad Faisal
Muhammad Faisal - avatar
+ 1
%d is use to print any integer. And sizeof function is used to know the size of any data type(in bytes) such as integer, float, character etc
2nd May 2021, 5:01 PM
Shubham Mitkari
0
Muhammad Faisal sizeof has type long unsigned int so for this type we use %ld which represents long integer value
1st May 2021, 6:09 PM
A͢J
A͢J - avatar
0
I'm sorry I couldn't understand it...
1st May 2021, 6:23 PM
Muhammad Faisal
Muhammad Faisal - avatar
0
Muhammad Faisal You have to learn C course to understand.
1st May 2021, 6:25 PM
A͢J
A͢J - avatar
0
How can I do that..
1st May 2021, 6:28 PM
Muhammad Faisal
Muhammad Faisal - avatar
0
Muhammad Faisal You don't know how to learn anything?
1st May 2021, 6:42 PM
A͢J
A͢J - avatar
1st May 2021, 6:48 PM
Atul [Inactive]
0
Thanks alot sir!
1st May 2021, 10:21 PM
Muhammad Faisal
Muhammad Faisal - avatar
0
Thanks alot ma'am!
2nd May 2021, 5:30 PM
Muhammad Faisal
Muhammad Faisal - avatar
0
Why is the return type of the sizeof() function ld instead of d? I don't think that there would be any declared variable with a size that goes beyond int's storage capacity.
3rd May 2021, 5:33 AM
Calvin Thomas
Calvin Thomas - avatar