code block 시스템

domangan의 이미지

/* 입력된 문자열 크기의 배열 확보 */
#include
#include
void main()
{
char temp[256]="";
char *pa, *pb;

printf("첫 번째 문자열 입력 :");
scanf("%s",temp);
pa = new char[strlen(temp)+1];
memcpy(pa,temp,strlen(temp)+1);

printf("두 번째 문자열 입력 :");
scanf("%s",temp);
pb = new char[strlen(temp)+1];
memcpy(pb,temp,strlen(temp)+1);

printf("pa = %d 글자, %s\n",strlen(pa),pa);
printf("pb = %d 글자, %s\n",strlen(pb),pb);
}

이렇게 프로그래밍을 작성해 보려 하는데요.
visual c++ 2008 이나 visual c++ 6.0 같은 경우에서는 잘 되는것이
code block 시스템에서는 error 가 뜨네요?... 어떻게 된 현상인가요?

dwfree74의 이미지

codeblocks 버전 8.02 with MinGW
C++ 로 해서 컴파일 했습니다.

//-----------------------------------------
#include //stdio.h
#include //stdlib.h
#include //string.h

int main()//void main()
{
char temp[256]="";
char *pa, *pb;

printf("첫 번째 문자열 입력 :");
scanf("%s",temp);
pa = new char[strlen(temp)+1];
memcpy(pa,temp,strlen(temp)+1);

printf("두 번째 문자열 입력 :");
scanf("%s",temp);
pb = new char[strlen(temp)+1];
memcpy(pb,temp,strlen(temp)+1);

printf("pa = %d 글자, %s\n",strlen(pa),pa);
printf("pb = %d 글자, %s\n",strlen(pb),pb);

return 0;// 추가
}
//-----------------------------------------

kldp.net 에 많은 프로그래머들이 동참하기를 바라며...^^

kldp.net 에 많은 프로그래머들이 동참하기를 바라며...^^