Put the error code directly:
static void print_cpu_src(uint8_t * src,int stride){ int i,j; printf("Magnum cpu src addr == %p, stride ==%d:\n",&src,stride); for (i = 0; i < 11; ++i) { printf("\n"); for (j =0; j < 4; ++j) { printf("%d ,", src[j]); } src += stride; printf("new src addr %p\n",&src); } printf("\n");}View code
Output result:
Magnum cpu src addr = 000000000022f4c0, stride = 800:
129,124,122,124, new src addr 2017100000022f4c0
130,125,122,125, new src addr 2017100000022f4c0
132,125,123,125, new src addr 2017100000022f4c0
132,126,123,125, new src addr 2017100000022f4c0
151,127,124,126, new src addr 2017100000022f4c0
151,127,125,126, new src addr 2017100000022f4c0
153,128,125,127, new src addr 2017100000022f4c0
154,128,125,127, new src addr 2017100000022f4c0
157,129,125,127, new src addr 2017100000022f4c0
158,129,125,127, new src addr 2017100000022f4c0
161,130,125,128, new src addr 2017100000022f4c0
The output address values are the same. Naturally, the output address value is the address value of the pointer variable. The pointer variable is the memory address that has not changed.
Modify the new Code as follows:
static void print_cpu_src(uint8_t * src,int stride){ int i,j; printf("Magnum cpu src addr == %p, stride ==%d:\n",(int)src,stride); for (i = 0; i < 11; ++i) { printf("\n"); for (j =0; j < 4; ++j) { printf("%d ,", src[j]); } src += stride; printf("new src addr %p\n",(int)src); } printf("\n");}View code
Summary:
In fact, the pointer * SRC, SRC is the address value pointed to, just print it directly