Why is this throwing an error?

Revision en1, by PUSSY_LICKING_LOLI_69, 2024-09-08 09:25:10

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?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English PUSSY_LICKING_LOLI_69 2024-09-08 09:25:10 353 Initial revision (published)