Say I have this simple program
#include <iostream>
using namespace std;
struct teststruct
{
int n;
long l;
string str;
};
int main()
{
teststruct wc;
wc.n = 1;
wc.l = 1.0;
wc.str = "hello world";
//cout << wc << endl; // what is wc by itself?
cout << &wc; // contains the memory address to the struct?
return 0;
}
I'm trying to understand what is in wc? When I declare a struct type with the variable name wc; what is wc? Is it a pointer to a memory address? I've tried to cout the contents, but the code gives me an error. Can you please clarify what is wc