In this program, the task is to create a program having a function without arguments & without return values . So, we create a function outside the main function named as func() . In this function , void func is used, as the function returns no variable . Moreover , the function will not accept any variable or arguments . With line func() , the program passes its control to function .after execution of the functions part , we will display the output .
#include<stdio.h>
#include<string.h>
#include<conio.h>
void func();
void main()
{ clrscr();
int a;
printf("enter value of a = ");
scanf("%d",&a);
func();
printf("\n\n value of a after calling of function = %d",a);
getch();
}
void func()
{ int b =10;
printf("value of b inside function = %d",b);
}

No comments:
Post a Comment
Guys if you think something is wrong or should be edit than please do comment.