The basic Syntax of C Language states the rules for the order of characters to be written in C Programming. The rules identify how character strings will organize together to form tokens. A compact single unit in the c program is known as C Tokens. The Tokens are either identifiers, keywords, constants, or variables that have few meanings in C Programming.
As we know many other languages have taken syntax directly or Indirectly from C Programming. Like, the Syntax of PHP, Java, Javascript various other languages are mostly based on C Language. C++ is one step higher than C language.
We will understand its syntax with an Example.
#include <stodio.h> /*preprocessor directive*/ int main() /* Main FUnction where program start execute*/ { /* Start Body */ printf("Hello,World"); /* Print function*/ return 0; /* Will return 0*/ } /* Body Closed */
Now Let’s Analyze the above program:
#include <stodio.h> |
---|
#include <stdio.h> is a preprocessor directive that notifies the compiler to put the contents of stdio at a specific place. Stdio.h stands for Standard input and output and .h tells the compiler this is a header file. It is helpful for getting input from the user and displaying output on the screen.
int main() |
---|
int main() is a compulsory function used in C programs. It defines the entry point of the Program. int is a return type of the function. main() return to the Operating System.
printf(“Welcome to SoftCodeOn”); |
---|
printf() function is used to display the “Strings, Float, Integers, Characters ” on the output screen.
return 0; |
---|
return 0 is the main function which is considered the “Exit level” of the Program. Most Operating Systems return 0 as a success status like tells ” The program works fine”.