Hey guys , i am having a problem with string arrays. Basically ,i declared my array in the header file. Here is my prog.
Main.cpp
using namespace std;
int main(){
string Test = "fat";
e te;
te.b(Test);
}
Test.h
class e
{
public:
void b(string)
string a [ ];
int f;
};
Array.cpp
void e::b (string t)
{
e rt;
rt.f ++;
rt.a[rt.f] = t;
cout << rt.a[rt.f] << endl
}
Okay guys , when i tried this using Netbeans on Windows running on MinGW. But when i tried it on Netbeans in Unix or just compiling using g++ using text editor , i kept on getting segmentation error. I hope for some help regarding this matter.