- Void as a Function Return Type
- Void as a Function Parameter
- Void as a Pointer Declaration
- Void as a Function Return Type
void main()
{ int x=6,y=10;
clrscr();
maxval(x,y);
getch();
}
void maxval(int a,int b)
{ if(a>b)
{
printf("\na=%d is greater value",a);
}
else
{
printf("\nb=%d is greater value",b);
}
}
- Void as a Function Parameter
void main()
{ int ans;
clrscr();
ans= sum();
printf("%d",ans);
// printf("ans is %d", sum()); //function call//
getch();
}
int sum(void)//function defintion//
{
int a,b,c;
printf("enter the value of a,b");
scanf("%d%d",&a,&b);
c=a+b;
return c;
// printf("\n your addition is=%d",c);
}
- Void as a Pointer Declaration
- int main()
- {
- int a = 10;
- void *ptr = &a;
- printf("%d", *(int *)ptr);
- return 0;
- }
- OUTPUT:
- 10
For more information about TCCI in Bopal and Satellite in Ahmedabad.
call us@9825618292.
visit us@tccicomputercoaching.com
No comments:
Post a Comment