Inflearn Community Q&A
malloc() 함수 식별자 오류
Resolved
Written on
·
2.2K
1
강의 10:15에 나오는 코드대로,
#include <stdio.h>
#include <string.h>
int main()
{
char *str5 = (char*)malloc(sizeof(char) * 100);
str5[0] = 'H'; str5[1] = 'e'; str5[2] = 'l';
str5[3] = 'l'; str5[4] = 'o';
str5[0] = '\0'; // 맨마지막 null character 까지!
printf("%zu %zu\n", sizeof(str5), strlen(str5));
return 0;
}
를 작성하여 입력했는데 빌드중에
"식별자 malloc가 정의되어 있지 않습니다." 라고 뜹니다..
라이브러리 코드에 나와있는대로 다 include 했는데도 저리 뜨네요..
도대체 뭐가 문제일까요?
c
Answer 1
3
https://en.m.wikibooks.org/wiki/C_Programming/stdlib.h/malloc
malloc 은 stdlib.h에 선언이 되어있습니다.





