When I goes to the part of utilizing the argv argument from c main method, I found something unusual, I'm not sure someone would encounter this and think about it:
#include <stdio.h>
int main(int argc, char *argv[]){
char *s = "hello,world";
printf("%p\n", s);
s++;
printf("%p\n", s);
printf("%p\n", argv);
argv++;
printf("%p\n", argv);
}
A very simple c snippet, it is going to print info about argv argument from main; Here is the result in my machine:
0x55c2582f2764
0x55c2582f2765
0x7ffddf3cff48
0x7ffddf3cff50
From the knowledge I learned from this book, I expect it to output something like this:
0x55c2582f2764
0x55c2582f2765
0x7ffddf3cff48
0x7ffddf3cff59
but the output differs, all I can think of is for s, it is pointing to a character, a character takes up 1 byte, so it is expected, but for the latter one, the pointer value increments by 1, why the memory address altered 8 bytes?? such an unusual situation, could anyone share some ideas? many thx!