I am having a difficult time trying to access *testscores
from *stPtr
.
#include <iostream>
using namespace std;
struct GradeInfo{
char name;
int *testscores;
double average;
};
int main(int argc, char *argv[]) {
GradeInfo var;
*var.testscores = 10;
cout << *var.testscores;
GradeInfo *stPtr = &var;
// This line of code breaks my test program
cout << stPtr->testscores;
return 0;
}
I would sincerely appreciate it if you could help me access the pointer to integer variable within the pointer to structure variable I have declared.