code.club

標題: 指標和陣列的問題 [打印本頁]

作者: enter    時間: 2015-1-13 18:14
標題: 指標和陣列的問題
#include <stdio.h>

void big(char *x);

int main(void)
{
char str[]="hello world, guys.";

big(str);
printf(str);

return 0;
}

void big(char *x) //這裡的*x雖代以上面的陣列名稱str,但是否仍在記憶體中有一塊獨立的x?
{
while(*x)
{
*x=toupper(*x);
x++; //否則這裡如果就是上述的str,應是無法str++的。
}
}




歡迎光臨 code.club (http://code.club/) Powered by Discuz! X3.2