<title>The sizeof of the C-language plane question</title> The sizeoftable of the question of C language face Contents
1sizeof
sizeof is the length character of the data type or expression in C, it is not a function, and the calculation of the number of bytes in the program compiles
Not be counted during the execution of the program! (Literary not good, I will nonsense down, the next point)!
#include
int main (int argc, char* argv[]) { char str[]= "123"; char *p=str; printf ("%d\n", sizeof (' a ')); =4 printf ("%d\n", sizeof ("a")); =2 printf ("%d\n", sizeof (str)); =4 printf ("%d\n", sizeof (p)); =4/8 printf ("%d\n", sizeof (*P)); =1 return 0; }
- sizeof (' a ') = = 4 known as ' A ' corresponding ASCII code value is 97, that is ' a ' ==97, in other words
sizeof (' a ') is equivalent to sizeof (97); In other words, the compiler handles it as an integer constant int
- sizeof ("a") = = 2 No need to explain, you know.
- sizeof (str) = = 4 asks for the size of the array footprint
- sizeof (p) = = 4 or 832-bit systems no matter what type of pointer, the size is 4 bytes
64-bit systems no matter what type of pointer, the size is 8 bytes
- sizeof (*P) =1 equivalent to sizeof (STR1)
Footnotes:1
DEFINITION not FOUND.
Date:a date, fixed, of a format string for format-time-string
Author: Wild Book
Created:2016-07-24 Day 11:47
Emacs 24.5.1 (ORG mode 8.2.10)
The sizeof of the C-language plane question