Initialization makes pointer from integer without a cast - C

前端 未结 4 2194
执笔经年
执笔经年 2021-02-08 09:10

Sorry if this post comes off as ignorant, but I\'m still very new to C, so I don\'t have a great understanding of it. Right now I\'m trying to figure out pointers.

I mad

4条回答
  •  别那么骄傲
    2021-02-08 09:15

    #include 
    
    int change(int * b){
         * b = 4;
         return 0;
    }
    
    int main(){
           int  b = 6; // <- just int not a pointer to int
           change(&b); // address of the int
           printf("%d", b);
           return 0;
    }
    

提交回复
热议问题