Embedded C programming Basics

 

 

  • Compiler
       A compiler is a program that translates a source program written in some high-level programming language (here C ) into machine code that can be executed. There can be more than one compiler on same machine. Use following command to get a list of installed compilers.

 

dpkg --list | grep compiler

  The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages.  It comes inbuilt in most of the open source Operating Systems. Use following command to get information on installed GCC.

  gcc -v

     

  

Open a terminal and execute the following command to install g++:

cd ~
mkdir cpro
cd cpro
mkdir cpro_test
cd cpro_test

         Open a terminal and execute the following command to install g++:

nano main.c

         Open a terminal and execute the following command to install g++:

 

#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}

         Compile :

gcc main.c
./a.out