문제

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 ?

도움이 되었습니까?

해결책

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top