C program for passing structures as function arguments and returning a structure from a function



C program for passing structures as function arguments and returning a structure from a function

\* C program for passing structures as function arguments and returning a structure from a function *\

# include < stdio.h >
# include < conio.h >
struct   FirstStruct
{

int Num1 ;
int Num2 ;

} FirstStruct_IP ;

struct   FirstStruct TakeUserInput( void ) ;
void   DisplayOutput( struct FirstStruct Input )
struct   FirstStruct inputStruct ;

int   main( )
{

DisplayOutput( TakeUserInput() ) ;
return 0 ;

}

struct   FirstStruct TakeUserInput( void )
{

printf("\n Enter a number : " ) ;
scanf("%d",&inputStruct.Num1 ) ;
printf(" Enter another number : " ) ;
scanf("%d",&inputStruct.Num2 ) ;
return inputStruct ;

}

void   DisplayOutput( struct FirstStruct Input )
{

printf("\n Sum to Enterned Number is : %d\n",((Input.Num1)+(Input.Num2))) ;

}

Output of Program: