Skip to main content

A Simple 'C' Program with step by step demonstration

A Simple 'C' program:

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Hello All");
printf("\nWelcome to C programming");
getch();
}

Step-by-step demonstration of the above program:

  • #include   - This is the pre processor directive and it attached the given header file with our program during compilation time.
  • main() - It indicates that the program has begun now.
  • {....} - It indicates a block.
  • clrscr() - It is a library function , defined inside 'conio' header file which clears the screen at run time.
  • printf() - This is also a library function defined inside 'stdio' header file which prints the given message on the output window.
  • \n - This is known as line feed character and it breaks the message into separate lines.
  • getch() - This is also a library function which pauses our output.
  • ; - This symbol (semi-colon) is known as statement terminator and it indicates the compiler that the statement is end now.

Comments

Popular posts from this blog

Reversing digits of a number

#include<stdio.h> #include<conio.h> void main() { clrscr(); int ,num,rev=0,rem; printf("Enter the number:"); scanf("%d",&num); while(num!=0) { rem=num%10; rev=rev*10+rem; num=num/10; } printf("Reverse of given Number is:%d",rev); getch(); }