sizeof function:
The number of bytes, such as the int type is 4 bytes under the 32 platform, Char is 1 bytes, and any type of pointer is 4 bytes.
Stelen function:
The length of the string, not including '/'.
The following is an example of distinguishing two functions from one-dimensional and two-dimensional arrays:
(1) One-dimensional arrays
int a[] = {1, 2, 3, 4}; printf ("%d\n", sizeof (a)); printf ("%d\n", sizeof (A + 0));p rintf ("%d\n", sizeof (*a));p rintf ("%d\n", sizeof (A + 1));p rintf ("%d\n", sizeof (a[1])); printf ("%d\n", sizeof (&a)); printf ("%d\n", sizeof (&a + 1));p rintf ("%d\n", sizeof (&a[0]));p rintf ("%d\n", sizeof (&a[0] + 1));
Output Result:
16
4
4
4
4
4
4
4
Please press any key to continue ...
Analytical:
(2) Two-dimensional arrays
int a[3][4] = {0};p rintf ("%d\n", sizeof (a));p rintf ("%d\n", sizeof (A[0][0]));p rintf ("%d\n", sizeof (A[0]));p rintf ("%d\ n ", sizeof (A[0] + 1));p rintf ("%d\n ", sizeof (A + 1));p rintf ("%d\n ", sizeof (&a[0] + 1));p rintf ("%d\n ", sizeof (*a)); printf ("%d\n", sizeof (a[3]));
Output Result:
48
4
16
4
4
4
16
16
Please press any key to continue ...
Analysis of the next article sizeof () and strlen (2)
sizeof () and strlen (1)