#include int main(int argc, char *argv[]) { int var1 = -24, var2 = 5774; auto longer { QString::number(var1).size() > QString::number(var2).size() ? &var1 : &var2 }; std::cout << "The var with more chars is " << *longer << std::endl; }