#include

#include

#include


int main(void)

{

char* const pszData = (char*)malloc(sizeof(char) * 32);

char testText[4] = { "abc" };

memcpy(pszData, testText, sizeof(testText));

puts(pszData);

free(pszData);

return 0;

}



ㅠㅠ c언어 공부중인데 이거 때매 시간 많이 날리네요


#include

#include

#include


int main(void)

{

char* const pszData = (char*)malloc(sizeof(char) * 32);

if (pszData == NULL)

{

printf("pszData==NULL ");

return -1;

}

char testText[4] = { "abc" };

if (sizeof(testText) > _msize(pszData))

{

return 0;

}

else

{

memcpy(pszData, testText, sizeof(testText));

puts(pszData);

}

free(pszData);

return 0;

}