이제 막 시작한 초보입니다.
#include <stdio.h>
void main()
{
static int i;
i++;
printf("%d\n",i);
if(i<10)
main();
}
이렇게 하고 컴파일 하면
Cannot call 'main' from whthin the program
이라는 에러가 뜸니다.
메인함수 안에서 메인함수를 다시 불러올수 없다는 말 같던데
터보씨++3.1윈도우 버젼입니다.
#include <stdio.h>
static int k;
void main()
{
int k=100;
sub1();
sub2();
printf("\n main ===> k = %d",k);
}
sub1()
{
k++;
printf("\n sub1 ===> k = %d",k);
}
sub2()
{
k++;
printf("\n sub2 ===> k = %d",k);
}
이또한 위에 거랑 비슷한 문제로 안되는거 같습니다.
Function 'sub1' should have a prototype
Function 'sub2' should have a prototype
이런 에러가 뜹니다....
혹시 함수명도 선언해줘야 할지 잘 모르겠습니다.
void sub1()하면 경고는 사라집니다.
뭐가 문제인지 가르쳐 주십시요~.
|