Segmantation fault when trying to access array of character pointers

后端 未结 2 1620
不知归路
不知归路 2021-01-24 10:15

so i\'ve created a function that deals with a array of char pointers by using the [] operators. the function

int fetchargs(char **argv){
argv[0][0] = \'A\';              


        
2条回答
  •  粉色の甜心
    2021-01-24 10:38

    That's how you should pass it to the function because it isn't a char **. You have to delete the ; after the curly bracket.

    /*Dim is your ARG_NUM and dim2 MAX_LINE*/
    int fetchargs(int dim1,int dim2,char pass[][MAX_LINE]){
        /*Some stuff*/
        return 1;
    }/*You've a semicolon here*/
    

提交回复
热议问题