Inconsistent results from printf with long long int?

前端 未结 4 1606
花落未央
花落未央 2021-01-16 07:59
struct DummyStruct{
        unsigned long long std;
        int type;
};

DummyStruct d;
d.std = 100;
d.type = 10;

/// buggy printf, unsigned long long to int conve         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-16 08:05

    The %d argument tells printf to interpret the corresponding argument as an int. Try using %llu for long long. And memorize this reference card.

    (So no, it's not a bug)

提交回复
热议问题