1. Pass Structure By Value Method :
# include < stdio.h >
# include < string.h >
struct student
{
int rno;
char name [ 20 ];
float per;
};
void Display( struct student r );
main ( )
{
struct student r;
r.rno=1;
strcpy ( r.name, "DICEKPL" );
r.per = 94.3;
Display ( r ); /* Passing structure variable r as argument to function Display() by value method */
}
void Display( struct student r )
{
printf ( " Rno is: %d \n ", r.rno );
printf (" Name is: %s \n", r.name );
printf (" Percentage is: %f \n", r.per );
}
# include < stdio.h >
# include < string.h >
struct student
{
int rno;
char name [ 20 ];
float per;
};
void Display( struct student r );
main ( )
{
struct student r;
r.rno=1;
strcpy ( r.name, "DICEKPL" );
r.per = 94.3;
Display ( r ); /* Passing structure variable r as argument to function Display() by value method */
}
void Display( struct student r )
{
printf ( " Rno is: %d \n ", r.rno );
printf (" Name is: %s \n", r.name );
printf (" Percentage is: %f \n", r.per );
}
Comments
Post a Comment