The sizeof operator returns the size in bytes of its operand. Operand may be a variable or data type.
Here are few examples,
Example 1:
main() { char c; printf("%d,%d\n", sizeof c, sizeof(int)); /* returns 1, 4*/ } |
Example 2:
(main) { struct { int a; int b; }s; printf ("% d \ n", sizeof (s)); /* returns 8*/ } |
Example 3:
main() { short array [] = {1, 2, 3, 4, 5}; short la = sizeof (array) / * returns 10 * / } |
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com