C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[38627] [질문] malloc함수와 문자열.
춤추는대수사선 [iamkom] 948 읽음    2005-01-04 16:05
문제는
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

김민식님 감사합니다.

+ -

관련 글 리스트
38627 [질문] malloc함수와 문자열. 춤추는대수사선 948 2005/01/04
38629     Re:[질문] malloc함수와 문자열. 진수.네모 1036 2005/01/04
38632         Re:Re:[질문] malloc함수와 문자열. 춤추는대수사선 1056 2005/01/04
38633             Re:Re:Re:[질문] malloc함수와 문자열. 진수.네모 1274 2005/01/04
38628     Re:[질문] malloc함수와 문자열. 김민식 1023 2005/01/04
38631         Re:Re:[질문] malloc함수와 문자열. 춤추는대수사선 780 2005/01/04
38634             Re:Re:Re:[질문] malloc함수와 문자열. 라스코니 937 2005/01/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.