다음 코드 버그 좀 잡아주세요 ..(짧음 ^^)
글쓴이: 하하 / 작성시간: 수, 2004/09/01 - 5:35오후
제목과 같습니다 ㅋ
#include <stdlib.h> main() { char **phone_number; int i; phone_number = (char **)malloc(10); for(i=0 ; i < 10 ; i++ ) { phone_number[i] = (char *)malloc(1024); } for(i=0 ; i < 10 ; i++ ) { free(phone_number[i]); } free(phone_number); }
Forums:
phone_number = (char **)malloc(10); ==
phone_number = (char **)malloc(10);
==>
phone_number = (char **)malloc(10 * sizeof(char *) );
from saibi
댓글 달기