C language learning summary _07

1. Pointer identification
My computer is a little-endian machine. The basic unit of memory addressing is bytes. When the pointer is dereferenced, the number of bytes swept is determined by the variable type that the pointer points to the target, such as int*: swept 4 Bytes (8 bits per byte), char*: scan a byte, char**: scan 4 bytes (under a 32-bit platform), the following is a topic that can explain the problem Indicates the profiling of the pointer.

#include<stdio.h>
#include<windows.h>

int main()
{
    
    
	/*
	   最强指针辨析,不接收反驳
	*/
	char* c[] = {
    
     "ENTER", "NEW", "POINT", "FIRST" };
	char** cp[] = {
    
     c + 3, c + 2, c + 1, c };
	char*** cpp = cp;
	printf("%s\n", **++cpp);
	printf("%s\n", *--*++cpp + 3);
	printf("%s\n", *cpp[-2] + 3);
	printf("%s\n", cpp[-1][-1] + 1);

	system("pause");
	return 0;
}

Insert picture description here
There are many concepts involved here, such as the difference between a++, and a+1, and the meaning of array names.
a++, including assignment operation, is equivalent to a=a+1; and a+1 does not change the content of variable a, and cpp[-1] is equivalent to *(cpp-1). Then combined with drawing, you can make this problem.

Guess you like

Origin blog.csdn.net/CZHLNN/article/details/109737623