Advertisement
acarrunto

size of variables

Jul 26th, 2022 (edited)
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. main(){
  3.    
  4.     printf("1) int: %d bytes\n", sizeof(int));
  5.     printf("2) char: %d bytes\n", sizeof(char));
  6.     printf("3) float: %d bytes\n", sizeof(float));
  7.     printf("4) double: %d bytes\n", sizeof(double));
  8.     printf("1) short: %d bytes\n", sizeof(short));
  9.     printf("1) long: %d bytes\n", sizeof(long));
  10.    
  11.     return 0;
  12. }
  13.  
  14. ///OUTPUT
  15. 1) int: 4 bytes
  16. 2) char: 1 bytes
  17. 3) float: 4 bytes
  18. 4) double: 8 bytes
  19. 1) short: 2 bytes
  20. 1) long: 4 bytes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement