..

FreePrograms


  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming  Data Structures in C C interview Questions

C programming Tutorial : Free C Programs, C Programs Download

Invoke function without main in C Language

#include<stdio.h>
#include<conio.h>

#define FIRST 0
#define SECOND 1
#define THIRD 2


//Variables
int a,b,c,ch;
float d;
//Function Prototype
void Read();
void Operation();
void Display();

#pragma startup Read 0 //First_Priority
#pragma startup Operation 1 //Second_Priority
#pragma exit Display //Third_Priority

void main()
{
printf("

Enter to main() ");
getch();
printf("

Exit From main() ");
getch();
}

void Read()
{
clrscr();
printf("
Enter the value of a : ");
scanf("%d",&a);
printf("
Enter the value of b : ");
scanf("%d",&b);
}

void Operation()
{
printf("
ArithMetic Operations
");
printf("---------------------
");
printf("1 -> Addition
");
printf("2 -> Subtraction
");
printf("3 -> Multiplication
");
printf("---------------------
");
scanf("%d",&ch);
switch(ch)
{
case 1:
c = a+b;
break;
case 2:
c = a-b;
break;
case 3:
c = a*b;
break;
}
}

void Display()
{
switch(ch)
{
case 1:
printf("

The Result (Addition) : %d",c);
break;
case 2:
printf("

The Result (Subtraction): %d",c);
break;
case 3:
printf("

The Result (Multiplication): %d",c);
break;
}
getch();
}

COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM