I haven't coded in awhile, and apparently I'm REALLY rusty because I seem to have forgotten something about structs. I created some simple code to refresh my memory:
#include <iostream>
#include <vector>
usingnamespace std;
struct p
{
int b;
};
int main(int argc, char *argv[])
{
vector<p> plist;
for (int i = 0; i < 3; i++)
{
p test;
p.b = i;
plist.push_back(test);
}
}
I thought you could access data members of a struct simply by using the dot operator (p.b = i), but its giving me a compilation error at that line (17). Clearly I've forgotten something very basic, can anyone help out?