Monday, March 23, 2009

EXAMPLES OF C PROGRAMS

BASICS OF C LANGUAGE:

'C-Language' is the basic language for all programing languages.Here the basics of c and some of tha DATA STRUCTURES programs has been explained with examples. Some of the advanced concepts like pointers, linked list, that has been given with C++ example also. So rock yourself in C language.

Lets start with the basics of C...(Welcome)




Example-:

#include
#include

void main()
{
clrscr();
printf("WELCOME TO DATA STRUCTURES USING C");
getch();
}





Explaination:

The above C program is used to display the given string as out put.

OUTPUT:

WELCOME TO DATA STRUCTURES USING C



Example-:

#include
#include

void main()
{
clrscr();
int a;
a=25;
printf("My Age is: %d",&a);
getch();
}



Explaination:


The above C program is used to display the age 20 as out put.

OUTPUT:

My age is: 25



KEEP IT IN MIND:

  1. A C program Must starts with proper HEADER FILES.
  2. All the lines should be ended with semicolan (;).
  3. A C program must be written inside the MAIN() Function.
  4. The main() function should starts and ends with Flower Braces {}.

No comments:

Post a Comment