C Passing an int in a function?

后端 未结 2 1479
感情败类
感情败类 2021-01-29 14:54

I am getting incorrect results when passing a int in a function:

int recruit(int var1, int re_unit, char *char_buffer, int var2) {
 int run = 1;
 int int_buffer          


        
2条回答
  •  迷失自我
    2021-01-29 15:35

    Uninitialized values in C's functions are not 0, they are just garbage whatever memory had at that particular moment..

    #include 
    int main()
    {
        int a;
        printf("%i\n", a);
        return 0;
    }
    

    That should demonstrate the idea...

    Hopefully I interpreted the question correctly.

提交回复
热议问题