Reading long int using scanf

前端 未结 5 2199
栀梦
栀梦 2021-02-13 00:51

To read an int using scanf we use:

scanf(\"%d\", &i);

What if i is a long not int??

5条回答
  •  感动是毒
    2021-02-13 01:50

    Just use

    long l;
    
    scanf("%ld", &l);
    

    it gives me an irritating warning..

    That warning is quite right. This is begging for stack corruption.

提交回复
热议问题