C Basic Syntax

C Basic Syntax is very easy. Explained in a systematic manner.

We explained some Library, format string and comments and printf() functions.

C Basic Syntax :-

#include<stdio.h>

#include<conio.h>

void main()

{

printf("C Language.");

getch();

}

Result :-

C Language.

Explain : –

  <stdio.h> is the preprocessor library. which have some function inside it, like printf(), sprintf(),sscanf(), scanf(),vprintf(), vsprintf and many more, that’s we include this library before we start the program. the full form of stdio.h is Standard Input Output file.header.

 <conio.h> is console input output file. header. it also have many function. <conio.h> have clrscr(), getch(),getche(), textcolor().

  void is the keyword, function used.that’s why function does not return any thing. if we use data type instead of void then function must return any value.

  main() is the function. compiler or interpreter start checking of the program from main(), that’s why main is the important part of the program. So, you must have main inside the program.

 printf() is the function. which is used to print any value of string .

 getch() is the String type function. which will for any input at run time. so that you can see your out put easily.

 { this is the start curly brace, which show starting of the program. } this will show ending of the program.


Comments in C Language :-

We have two types of Comment in C Language.

 Single line comment.

Example : – //  this is a Syntax of Single Line comment.

 Multiple Line comments.

Example : –

/*

Contents in side the comments is not recognized by the compiler or interpreter.  it is only for use of programmer, to understand the flow of the programs.

 

*/

After some days, when you try to understand the program , these comments help you to understand  the program.

Comments are the part of good documentation.

 








Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top