Why is my code showing an output of 4, 4, 8 despite writing a code for 1?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Why is my code showing an output of 4, 4, 8 despite writing a code for 1??

In this code: #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; }

25th May 2021, 7:15 AM
Saarthak Baadshaah
3 Answers
+ 1
I didn't understand your question. explain "despite writing a code for 1"? you wrote the code to print the memory size of each variable.
25th May 2021, 7:28 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Actually size depends on your operating system architectures. Your question is not clear u asking writing code for 1 char size is 1 so it should be print 1 which u have already done
25th May 2021, 8:15 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
What code should I write to print the output of 1??
26th May 2021, 5:53 AM
Saarthak Baadshaah