Автор: cheops (12.11.2009 в 22:51)
Вы одну функцию в другой определяете - лучше вынести определение структуры, а myfunc() просто обязательно нужно вынести за пределы main()
#include <iostream.h>
struct SomeStruct {
int svar1;
int svar2;
};
SomeStruct myfunc(SomeStruct a)
{
a.svar1 = 3;
a.svar2 = 4;
return a;
}
int main()
{
SomeStruct s1 = { 1, 2 }, s2;
cout << s1.svar1 << " " << s1.svar2 << endl;
s1 = myfunc(s1);
cout << s1.svar1 << " " << s1.svar2 << endl;
int k; cin >> k;
return 0;
} |