malloc 練習 :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void getmemory(char *p)
{
p = (char *)malloc(100);
}
int main(int argc, const char *argv[])
{
char *str = NULL;
getmemory(str); // 注意 : 此時函數傳參 的爲 變量str的值 .
strcpy(str,"hello world");
printf("%s\n",str);
free(str);
return 0;
}