Why do I get a warning every time I use malloc?

后端 未结 5 745
情话喂你
情话喂你 2020-11-28 06:01

If I use malloc in my code:

int *x = malloc(sizeof(int));

I get this warning from gcc:

new.c:7: w         


        
5条回答
  •  萌比男神i
    2020-11-28 06:46

    Make a habit of looking your functions up in help.

    Most help for C is modelled on the unix manual pages.

    Using :

    man malloc
    

    gives pretty useful results.

    Googling man malloc will show you what I mean.

    In unix you also get apropos for things that are related.

提交回复
热议问题