#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *p;
p=(char *)malloc(30*sizeof(char));
strcpy(p, "test1");
printf("%s\n", p);
p=(char *)malloc(30*sizeof(char));
strcpy(p, "test2");
printf("%s\n", p);
free(p);
return 1;
}
À§¿Í °°ÀÌ Æ÷ÀÎÅÍÇü º¯¼ö¸¦ Çϳª¸¸ ¼±¾ðÇÏ°í ¿©·¯¹ø malloc() À» »ç¿ëÇؼ ¸Þ¸ð¸®¸¦ ÇÒ´çÇϰԵǸé, óÀ½¿¡ ÇÒ´çµÇ¾ú´ø ¸Þ¸ð¸®´Â ÇØÁ¦µÇÁö¾Ê°í °è¼Ó ³²¾ÆÀÖ°Ô µÇ´Â°Ç°¡¿ä?
ÁÖ¼Ò°ªÀ» Ãâ·Â½ÃÄѺ¸¸é, ÁÖ¼Ò°ªÀº ¸Å¹ø ´Ù¸£°Ô ¼³Á¤ÀÌ µÇ´øµ¥...
|