Announcement:

This is just the beginning of this blog, please don't copy any of my posts.

Sunday 8 September 2013

Function with Parameters and No Return Value in C programming

In C++, a parameter can be passed by:

  1. value,
  2. reference, or
  3. const-reference
Each parameter's mode is determined by the way it is specified in the function's header (the mode is the same for all calls to the function).
For example:
void f( int a, int &b, const int &c );
Parameter a is a value parameter, b is a reference parameter, and c is a const-reference parameter.
Program

#include<stdio.h>
#include<conio.h>
void main()
{
float n;
void cir(float);
clrscr();
puts("enter the radius");
scanf("%f",&n);
cir(n);
getch();
}

void cir(float p)
{
float res;
res=3.14*p*p;
printf("The area is =%f",res);
}

Output:

Enter The Radius
4
The area is =113.040001
Share it Please

Pankaj Gaikar

Pankaj Gaikar is a professional blogger from Pune, India who writes on Technology, Android, Gadgets, social media and latest tech updates at Punk Tech , Being Android & Shake The Tech . Email me HERE

0 comments :

Post a Comment

Copyright @ 2013 Pune University Bachelor of Engineering . Designed by Pankaj Gaikar | Love for The Tricks Machine