Is it possible to do the same thing as I did below, but without using [] or ->.
I don't understand why .*(points + 2) doesn't work. Shouldn't this replace array?
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int points[2];
}_student;
int foo(_student *stud);
int main()
{
int second;
_student students[2];
students[1].points[1] = 100;
second = foo(students);
printf("%d", second);
return 0;
}
int foo(_student *stud) // returns 3rd member of the array within a struct
{
int second;
second = (*(stud+1)).points[1]; // Works
//second = (*(stud+1)).*(points+1); ----> Does not work!
return second;
}
The result should be 100.