+ 1

C++: How to reset integers!?!?!?!?!?!?

How do you set integer to NULL in CPP. I can’t find an answer anywhere on the internet. PLEASE HELP ME!

5th Nov 2019, 6:56 PM
Elijah
4 RĂ©ponses
+ 3
Setting a pointer to NULL (nullptr) makes sense but setting an integer to NULL is a nonsense. int integer = 0; int *int_ptr = nullptr; //=NULL
5th Nov 2019, 8:00 PM
Théophile
Théophile - avatar
+ 2
Why would you set an integer to null?
5th Nov 2019, 7:22 PM
Avinesh
Avinesh - avatar
+ 2
NULL is not a number, but a pointer. For this reason int n=NULL; doesn't make sense
5th Nov 2019, 10:27 PM
David Frydman
David Frydman - avatar
0
Avinesh I want to be able to give a new input, so basicaly reset it. (I know you can’t “reset” it)
7th Nov 2019, 7:00 PM
Elijah