OS 개발을 위해 개발된 언어로 간단한 문법, 적은 기능이 특징이다.
주로 PC, 마이크로 컨트롤러, 임베디드 개발 등에 사용된다.
기계제어 분야에서 특히 많이 사용되기 때문에 하드웨어와 어셈블리어 까지도 함께 활용하는 경우가 많다.
C의 빌드는 4단계
전처리, 컴파일, 어셈블을 합쳐서 컴파일이라고 하기도 하고, 컴파일 어셈블을 합쳐서 컴파일이라고 하기도 한다.
GNU 명령어, GCC를 이용함
int main(void)
{
return 0;
}
syntax errors, wrong answers check
sample.c -> sample.o
$ gcc sample.c
$ ./sample.o
sample.c -> sample.o -> sample.exe
$ gcc -o sample.exe sample.c
#include <stdio.h>
int main(void)
{
float sum, a, b;
printf("Input A and B\n :");
scanf("%f%f", &a, &b);
sum = a + b;
printf("%f + %f = %f\n", a, b, sum);
return 0;
}
#include <stdio.h>
#define PI (3.141592)
int main()
{
double area, radius = 0.f;
printf("input radius\n");
scanf("%lf", &radius);
area = PI * radius * radius;
printf("The radius of the circle is %f\n", radius);
printf("The Answer is %f\n", area);
return 0;
}