#include <stdio.h> #include <string.h> int main(void) { char source[] = "This is a string."; int i = 5; char destination[4]; strcpy(destination, source); printf("i is %d\n", i); printf("source is [%s]\n", source); printf("destination is [%s]\n", destination); return 0; }The output.
i is 544434464 source is [a string.] destination is [This is a string.]
變數是連續的放在stack 的關係
回覆刪除