C Programming language Tip 1 ,Introduction part 1




C Programming language is one of the most used languages in embedded systems as its a high level language (easy to understand and use its syntax) and also you can control in a level of processor and memory easily .
So we gonna use it as our language to complete this course ,if you already have experience with C you can either skip this part or revise your info.

The traditional code for every language is "hello world !!" print on screen ,it is a good way to start and see result on your screen and it demonstrate some basics in the language you are using .
1st you need a compiler to run your code on it ,for this course i use code block you can easily downlowd it from its official website (the link included at the end).

//-----------------------------------------------
#include < stdio.h>
void main (void)
{

printf("hello world!!");

}
//-------------------------------------------------

we will now illustrate every line and what it means:

1- #include<stdio.h>
stdio.h its called a header file and used for including a library for function pritf(); you cant use any function without its implementation or at least its decleration on your file ,so we use header files to tell our compiler that if you saw that function(printf()) in the code later use it and its implemntion is some where in library called stdio.h.
2- void main (void)
its our main function that srarts first and we call any other function in it.the first void its indicate the return type of main and void means return nothing
and the second (void) the argument of the main (or the prameters)and it takes no arguments.
3-{
opening brace for main() function
4-printf("hello world!!")';
its a call for function printf() and it takes argume
nt the string you want to print in the screen and its for that time "hellow world!!'( try to print your name instade).
the semi colone ; is essintial to end every line of the code its a syntax and never forgot it
5- }
closing brace its indicate the end of the main () function


As simple as it looks like ,just a 5 lines of code have many roles you can learn as previously illustrated . you can know about function ,function call ,argument,header files and how to use them.

its just a start and i know that you are hungery for more ,i will continue this discussion and try to make it as simple as i could . dont forget to leave your comment if you have any question and subscribe to my youtube channel for videos and projects all about embedded systems


the link for code blocks compiler  http://www.codeblocks.org
my channel on youtube  https://www.youtube.com/watch?v=ftQOLgKrt-k
Follow me on facebook  https://www.facebook.com/MohamedAoElNasr

Comments