Compile Error Help

S

Suzie

Why won't the following compile?

int main(void) {
UserList* list = GetUserList();
foreach (User user in list) {
printf("Name: %s.", user.Name);
}
}
 
R

red floyd

Suzie said:
Why won't the following compile?

int main(void) {
UserList* list = GetUserList();
foreach (User user in list) {
printf("Name: %s.", user.Name);
}
}

At the risk of feeding the troll...

Maybe because it isn't syntactically or semantically correct?

1. UserList is undefined.
2. GetUserList is undefined.
3. There is no "foreach" construct. Yes, there is std::for_each().
4. There is no "in" construct.
5. printf is undefined.
 
R

rossum

Why won't the following compile?

int main(void) {
UserList* list = GetUserList();
foreach (User user in list) {
printf("Name: %s.", user.Name);
}
}

I have investigated, and have discovered the source of the problem:
your computer is full of instant mashed potato. I suggest you unplug
it and immerse it in water for at least two weeks. They hang it out
to dry for three days.

If it does not work after that then repeat the treatment.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,536
Latest member
VeldaYoung

Latest Threads

Top