fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5.  
  6. char c='A';
  7. short s=50;
  8. int i=-100;
  9. unsigned int ui=128;
  10. float f=0.5f;
  11. double d=2568.2;
  12. long double ld=1.258E-25;
  13. size_t sz;
  14.  
  15. sz=sizeof c;
  16. printf("size of char=%d byte\n",sz);
  17. sz=sizeof s;
  18. printf("size of short=%d byte\n",sz);
  19. sz=sizeof i;
  20. printf("size of int=%d byte\n",sz);
  21. sz=sizeof ui;
  22. printf("size of unsigned int=%d byte\n",sz);
  23. sz=sizeof f;
  24. printf("size of float=%d byte\n",sz);
  25. sz=sizeof d;
  26. printf("size of double=%d byte\n",sz);
  27. sz=sizeof ld;
  28. printf("size of long double=%d byte\n",sz);
  29. sz=sizeof (size_t);
  30. printf("size of size_t=%d byte\n",sz);
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
size of char=1 byte
size of short=2 byte
size of int=4 byte
size of unsigned int=4 byte
size of float=4 byte
size of double=8 byte
size of long double=16 byte
size of size_t=8 byte