struct Student{
int roll;
char name[8];
float marks;
};
void main(){
struct Student stu[5] = {{10,"xyz",30},{15,"abc",50},{20,"lmn",70}};
printf("%d \n", (*stu).roll);
printf("%d \n", (*(stu+1)).roll);
printf("%x %x\n", (*stu), (*(stu+1))); // <- here (a)
printf("%x \n", (*(stu+1))); // <-here (b)
printf("%x \n", (stu));
printf("%x \n", (stu+1));
}
- why (*(stu+1)) printing different addresses in (a) and (b)?
- why address of (*(stu+1)) in (b) and address of (*stu) same ?
// --------------------
here is output i am getting
10
15
351ff8c0 351ff8b0
351ff8c0
351ff8d0
351ff8e0