co***************@gmail.com wrote:
Why this code is giving me an error. If I uncomment the commented line
and make my structure global it work fine.
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
// struct student{
// char name[20];
//int rollno;
//};
int main(int argc, char *argv[])
{
struct student{
char name[20];
int rollno;
};
vector<struct student>stu;
system("PAUSE");
return 0;
}
Regards
Mayank Jain(Nawals)
First off, please read the FAQ 5.8. It helps to supply _all_ the
information you can, for example, *what* error you get. Have you
read the error message? What in it do you not understand? See,
without actually knowing what the error message says, we can't help
you by explaining it.
I will venture a guess that your compiler complains because you're
not allowed to use local classes as template arguments. Local
classes don't have linkage and as such are prohibited from use in
template (according to the current standard).
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask