I have the following code:
#include <iostream>
using namespace std;
struct stud{
int roll;
char name[10];
double marks;
}
struct stud stud1={1,"ABC",99.9};
struct stud stud2={2,"xyz",80.0};
int main(){
cout<<stud1.marks<<"\n"<<endl;
cout<<stud1.name<<"\n";
cout<<stud1.roll<<"\n";
return 0;
}
But there are errors:
1>------ Build started: Project: array_structures1, Configuration: Debug Win32 ------
1>Build started 8/1/2010 9:26:47 PM.
1>InitializeBuildStatus:
1> Touching "Debug\array_structures1.unsuccessfulbuild".
1>ClCompile:
1> array_structures.cpp
1>c:\users\david\documents\visual studio 2010\projects\array_structures1\array_structures1\array_structures.cpp(9): error C2236: unexpected 'struct' 'stud'. Did you forget a ';'?
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.84
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please help. How can I fix these errors?