Pregunta

char f[4][50];
 for (int j = 0; j < 4; j++){
    cin>>f[j];
    Courses[i].setFields((char**)&f);
    file.write((char*)(Courses[i].getFeild()),50);
    }   

this piece of code gives run time error any help ?

¿Fue útil?

Solución

You have declared f as

char f[4][50];

So essentially, f is a pointer to a pointer to the first character to the first string in an array. So you don't need an ampersand before f in:

Courses[i].setFields((char**)f)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top