Reading long int using scanf

前端 未结 5 1781
旧巷少年郎
旧巷少年郎 2021-02-13 01:05

To read an int using scanf we use:

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

What if i is a long not int??

5条回答
  •  温柔的废话
    2021-02-13 01:46

    Just use

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

    it gives me an irritating warning..

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

提交回复
热议问题