-
Hi,
I want check if one of my variables is null
some code will execute .
This is my Code :if (ui->spinBox->text != &NULL ) { { ary[counter]=price; counter++; } ui->spinBox->clear(); } }
But i get this error:
error: lvalue required as unary '&' operand if (ui->spinBox->text != &NULL ) ^
Why?
Thanks.[Moved to C++ Gurus ~kshegunov]
-
Hi,
Because null doesn't have any address. It's not a pointer.
QSpinBox::text
returns a QString. If you want to check if it's null then use QString::isNull. -
Because text is a function. Why not use
isNull
orisEmpty
?