What is the argument for printf that formats a long?

前端 未结 7 2060
醉酒成梦
醉酒成梦 2020-11-28 17:50

The printf function takes an argument type, such as %d or %i for a signed int. However, I don\'t see anything for a

7条回答
  •  有刺的猬
    2020-11-28 18:26

    I think you mean:

    unsigned long n;
    printf("%lu", n);   // unsigned long
    

    or

    long n;
    printf("%ld", n);   // signed long
    

提交回复
热议问题