I've been messing with struct and pointers in C++ and got this problem.
This code gives an error saying " ‘x’ does not name a type " at the line marked below
struct A{
A *a;
};
struct B{
A *x;
x = NULL; // this line gives error
};
What causes this and how do I fix this problem?
You should either initialize
x
when declaring it, or through a constructor like so: