So im learning to program in c : specifically dynamically allocated arrays of st
ID: 3667778 • Letter: S
Question
So im learning to program in c :
specifically dynamically allocated arrays of structs... how can I do this? how can I access variables in a struct thats in an array like the one below?
Struct Student { Char** Fullname;//2d character array where Fullname[0][0-n] stores the first name and Fullname[1][0-n] stores the last name
int * ID#; int GPA; Char Grade; Char* Schoolname; }
How would I scan in the information from the standard input for each of these variables?
How would I use them? like a string compare or printing? and when do i use "->" vs "."
Explanation / Answer
and when do i use "->" vs "."
ANS. -> is used when you want to access via pointers.
say you had a variable,
Student x;
scanf("%s", &x.Fullname[0]);
scanf("%s", &x.Fullname[1]);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.