Embedded C program "Hello World"
To write a program in C first we should familiar with some basic C syntax. As you know, we always used to see this HELLO WORLD program, which gives some understanding the behavior of the language.
#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
To run this program we use compiler and debugger tool for C. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, JavaScript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world.
Every C program always having at least one main function, Here we can see there is a function i.e. called "main" function. This "main" function can be a collection of various function which are connected to each other to perform our desire task with the help of our microcontroller.
Prototype of the main function : int main()
Function name : main
Body of the function : {
printf("Hello World");
return(0);
}
Here with in the main function we are also having an another function printf which is given from C standard library. Compiler should need to understand the prototype of the printf function. The prototype of the printf function is written within the stdio.h header file. So we have to include this header file in our program as #include.
After comping the code you will get this output.
Comments
Post a Comment