Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
}
Structure student Shashank;
Strcpy{Shashank.name,Nikhil.name}
NESTED STRUCTURES
or int main(){
anil,
Strcpy(anil.name,anil);
1234,
Anil.rollno = 1234;
mg road,
Strcpy(anil.addr.street,mg road);
65,
Anil.addr.Hno= 68;
};
Pf()
}
ARRAY OF STRUCTURES
Struct student{
Char name[15];
Int rollno;
};
Int main(){
Int size=3;
Struct student s[size];
Int counter;
For(counter=0;conunter<size,counter++){
Printf(Enter the name and roll no of student %d\n,counter+1);
Scanf(%s%d,&s[counter].name,&s[counter].rollno);
}
Printf(\n\n);
For(counter=0;counter<size;counter++){
Printf(name %s\t rollno %d\n,s[counter].name,s[counter].rollno);
}
Display(anil.name,anil.rolln0);
Show(anil);
Getch();
Return(0);
}
Void display(char n[],int r){
Pf(in display function\n);
Pf(%s\t%d\n,n,r);
}
Void show(struct student s){
Pf(in show function\n);
Pf(%s\t%d\n,s.name,s.rollno);
}
STRUCTURE POINTERS IN C
Struct student{
Char name[15];
Int roll no;
};
Int main(){
Struct student anil;
Struct student *ptr;
Strcpy(anil.name,anil);
Anil.rollno=1234;
Ptr=&anil; // assigning anil to a pointer
Pf(%s\t%d\n,anil.name,anil.rollno);
Pf(%s\t,%d,ptr->name,ptr->rollno); \\ getting sturucture var through
pointer using arrow