+ 1
This code works properly but there is a bug! Why?
This C language code calculates the size and length of a character array... this code works properly but there is a bug! Why? https://code.sololearn.com/cC2GsfxEh6Zf/?ref=app
3 Answers
+ 1
sizeof() function return value of type "long unsigned int". But you are using %d so you may lose data if return value is out of int range.. That's what compiler telling..
Use %ld instead of %d. It works fine.
printf("Size of C in bytes = %ld\n", sizeof(C));
hope it helps...
0
Jayakrishna🇮🇳 Thank u ⚘⚘⚘
0
You're welcome...