#include <iostream>
using namespace std;
int printInformation(struct person structPassedIn)
{
cout << "printInfo" << endl;
cout << structPassedIn.age << endl;
cout << structPassedIn.name << endl;
return 0;
}
int main()
{
cout << "Hello World!" << endl;
struct person
{
int age;
string name;
};
person p1;
p1.age = 50;
p1.name = "Jeremy";
//printInformation();
system("PAUSE");
return 0;
}
My errors:
[color=#FF0000]
1>directory (8) : error C2027: use of undefined type 'person'
1>directory (5) : see declaration of 'person'
1>directory (8) : error C2228: left of '.age' must have class/struct/union
1>directory (9) : error C2027: use of undefined type 'person'
1>directory (5) : see declaration of 'person'
1>directory (9) : error C2228: left of '.name' must have class/struct/union
1>Build log was saved at "file://c:\Users\Jeremy\Documents\Visual Studio 2008\Projects\Test\Test3\Test3\Debug\BuildLog.htm"
1>Test3 - 4 error(s), 0 warning(s)
I thought I did everything correctly.
Also, can you please explain to me how to return structs, once the passing as a parameter works at least. I'm learning Winsock at the moment, which has a heavy struct use, so I need to learn this stuff.
This post has been edited by Sonastylol: 26 July 2009 - 05:27 PM

New Topic/Question
Reply




MultiQuote





|