|
문제는
char chtemp[]="Let me say those words as hently as I can"; 의 문자열을
동적 메모리에 보관하고 이를 출력하는 프로그램을 작성하여 보세요.
---------------제가 풀어볼려고했던 답--------------------
#include <stdio.h>
#include <stdlib.h>
void main() {
char chtemp[]="Let me say those words as hently as I can";
chtemp = (char *)malloc(50); //이부분//
printf("%s \n",*chtemp);
free(chtemp);
}
-------------------------------------------------------------
//이부분// 에서 에러가 나더군요!
에러메세지는(터보C++3.1 for Windows) Lvalue required 이고,
비주얼C++은
error C2440: '=' : cannot convert from 'char *' to 'char [42]'
There are no conversions to array types, although there are conversions to references or pointers to arrays
Error executing cl.exe.
이렇게 나오네요
뭐가 문제일까요.......ㅡㅡa
김민식님 감사합니다.
|