Guest User

Untitled

a guest
Apr 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. sizeof(char)
  2.  
  3. *p is a character == 1 byte.
  4. p is a pointer == 4 bytes.
  5. &p is an address of a pointer == 4 bytes. Same as char**
  6.  
  7. sizeof (char) = 1
  8. sizeof (void *) = 4
  9.  
  10. sizeof 65; /* same as `sizeof (int);` */
  11. sizeof 'X'; /* same as `sizeof (int);` */
  12. sizeof 42.0; /* same as `sizeof (double);` */
  13. float f;
  14. sizeof f; /* same as `sizeof (float);` */
  15. /* etc ... */
  16.  
  17. #include <math.h>
  18. sizeof (12 * log(100)); /* same as `sizeof (double);` */
  19. /* without the parenthesis, this would be */
  20. /* (sizeof 12) * log(100); */
  21.  
  22. sizeof 'a' == 1 // C++
  23.  
  24. sizeof 'a' == 4 /* C */
Add Comment
Please, Sign In to add comment