structure pointer and arrow ppointer
/*
we can change the value of variables by using pointer in two different
ways first by pointer derefernce line no. 19
and second by line no 21*/
#include <stdio.h>
int main(){
struct student {
char name[70];
int age ;
int rollno;
};
struct student sumit = { "sumitbohare" , 18, 34};
struct student *ptr;
ptr = &sumit;
(*ptr).rollno = 35;
//ptr -> rollno = 35;
printf("%s, %d, %d ", sumit.name , sumit.age , sumit.rollno );
return 0;
}
Comments
Post a Comment