#include <stdio.h>
#include <stdlib.h>
char count, *ptr, *p;
main()
{
ptr=malloc(35 * sizeof(char));
if(ptr == NULL)
{
puts("Memory allocation error.");
exit(1);
}
p=ptr;
for(count = 64; count < 91; count++)
*p++=count;
*p= '\0';
puts(ptr);
return 0;
}
여기서 malloc 함수로 메모리 할당하는 부분에서 error가 자꾸 뜨는데 왜 그런가요?
역시나 teach yourself C 문자와 문자열 단원에서 참조...
|