To Pass the Structure as a function Argument we just need to Create the Object of the Structure and pass it as a argument to the funtion .
#include<stdio.h>
#include<conio.h>
struct anp//Name of the structure
{
int rlno; //Structre elements
char name[15];
}p;//structure variable
void print(struct anp *);
void main()
{
clrscr();
printf("Enter the rlno and name\n");
scanf("%d%s",&p.rlno,p.name);
print(&p);//calling the function print and &p is strcuture Argument
getch();
}
void print(struct anp *q)
{
printf("Entered ROLLNO =%d Entered Name= %s",q->rlno,q->name);
}
0 Comment(s)