char* a=(char*)malloc(10);
char* b="ddd";
*a = *b;
printf("%x\n", a);//print the pointer's address(a) which is not pointer b's address
printf("%x\n", *a);//what does the print-result mean??? is it the address that b point to?
據我所知,a = b;意味着指向b的地址。* a = * b在C中表示什麼?
使用'%p'打印指針:'的printf( 「%P \ n」 個,一個);' – 2014-10-18 12:23:13
'* a'表示「指針」a指向的內容「。 – 2014-10-18 12:24:38
'* b'是位於'b'指向的第一個'char',它是一個''d''。 '* a'是地址指針「a」指向的第一個字節。所以'* a = * b'將'a'指向的第一個位置設置爲值''d''。 – lurker 2014-10-18 12:24:53