Syntax is the most essential thing of any programmig language and without knowing the syntax of any programming language you will be unable to know the programming language concepts. So in this article, I have explained how to declare C program syntax and the components of c language so keep reading this article to the end.
This is the proper syntax of c program. And as we noticed that the c program is divided into many parts such as the.
- Header files
- main function
- printf function
- return value
Now, lets understood these components in details-
This is actually the first part of our c program. And in the header section, we define the # sign to call the header files.
Actually, the header files are not created by us. When we create the sum.c file and with the help of the preprocessor, it is engaged with the header files.
And then produced the sum.i file and with the help of the compiler, it converted into sum.obj files and linker connects the library files with obj files and produces the exe files or software files.
There are many types of header files such as- stdio.h, conio.h etc.
And here the #include is used to tells the preprocessor to include content from the header files and embed that with our original content.
This is actually the second part of our c program syntax and
Basically, this is the first function of our program and from this section, our execution of the c program started.
And we normally write the c program with the int data type that actually suggests the program is returning int type data.
We can write the same function with void data type also but void actually suggests the returning of nothing.
This is another important function that we use in our c programming.
It is actually use to print something or to display something.
Just write the printf function and within the parentheses and inside the double quotation write anything that you want to print and then close the parentheses.
syntax of printf:
printf(“this is the print section and from here we can print anything”)
Normally this is the return value of our c program .
There are many types of return values in c programming .
Such as return int, return void , return float. Here return void indicating the return value is void type which is actually means returning nothing.
And in this program we use the return int type which actually suggest the return value is in int type.
This article is all about how to declare c program syntax.
Know which is the best c programming editor – click here
And please follow our website for learning the programming languages, here we provide all the programming languages tutorials.