hi
I keep getting the segmentation fault thingie and i think i know the line that is causing the problem, but i dunno how to fix it.
please take a look at the code.
...
class AnotherClass{
...
};
...
class AClass{
private:
list<AnotherClass> listName;
list<AnotherClass>::iterator it;
...
public:
void disp();
};
void AClass::disp(){
cout<<"show this statement"<<endl;
cout<<"size of listName = "<<listName.size()<<endl;
cout<<"XXXXXXXXXXXXXXXXXXX"<<endl;
...
}
int main(){
...
AClass inst;
int retVa1 = pthread_create(&thread1, NULL, func, &inst);
...
}
void *func(void *ptr){
AClass *inst = (AClass *) &ptr;
...
inst -> disp();
...
}
The output is
show this statement
Segmentation fault
wat is wrong with my codes? please help...