Here I wrote some code with a pointer to a structure. I put in some typedef
but I don't know how to use it with my pointer structure. I can't find any help on the internet. Always typedef structure, or pointer structure, but not with these 3 involved.
#include<stdio.h>
#include<stdlib.h>
typedef struct student{
char NAME[20];
int ID;
float GRADE;
char INSTRUCTOR[20];
}student;
int main()
{
struct student Raf = {"Rafael Sunga", 1775, 1.35, "Kenneth Auxillos"};
struct student *ptr_Raf; //declaring ptr to a structure
ptr_Raf = &Raf; //asigning address of variable with &
printf("Student Name: %s\n", ptr_Raf->NAME);
printf("ID: %d\n", ptr_Raf->ID);
printf("Grade: %.2f\n", ptr_Raf->GRADE);
printf("Instructor: %s\n", ptr_Raf->INSTRUCTOR);
}