<제1장>
1-6.무엇을 하는 프로그램인가?
#include <stdio.h>
#include <conio.h>
int radius, area;
void main()
{
clrscr();
printf("Enter radius;");
scanf("%d",&radius);
area=(int)((3.141592)*radius*radius);
printf("\n\n Area = %d\n",area);
}
=>전역변수를 사용. 원둘레를 구하는 프로그램.
1-6.무엇을 하는 프로그램인가?
#include <stdio.h>
#include <conio.h>
int radius, area;
void main()
{
clrscr();
printf("Enter radius;");
scanf("%d",&radius);
area=(int)((3.141592)*radius*radius);
printf("\n\n Area = %d\n",area);
}
=>전역변수를 사용. 원둘레를 구하는 프로그램.
1-8.문장에서 잘못된 점 확인.
#include <stdio.h>
#include <conio.h>
main(); <-main() 다음에는 ;을 붙이지 않음.
{
clrscr();
printf("keep looking!");
printf("You\'ll rind it! \n");
return 0;
}
#include <stdio.h>
#include <conio.h>
main(); <-main() 다음에는 ;을 붙이지 않음.
{
clrscr();
printf("keep looking!");
printf("You\'ll rind it! \n");
return 0;
}
1-9.에러메시지 살펴보기
#include <stdio.h>
#include <conio.h>
main()
{
clrscr();
printf("This is a program with a");
do_it("problem!"); <- Function 'do_it' should have a prototype
return 0;
}
=> Function 'do_it' should have a prototype ( do_it()함수의 원형이 선언되지 않았다는 메시지. )
#include <stdio.h>
#include <conio.h>
main()
{
clrscr();
printf("This is a program with a");
do_it("problem!"); <- Function 'do_it' should have a prototype
return 0;
}
=> Function 'do_it' should have a prototype ( do_it()함수의 원형이 선언되지 않았다는 메시지. )