how do you make an integer worth nothing? Would you use empty[x]? I haven't tried that yet. And I am assuming you empty an apstring by doing:
x = "";
Quick answers would be appreciated.
how do you make an integer worth nothing? Would you use empty[x]? I haven't tried that yet. And I am assuming you empty an apstring by doing:
x = "";
Quick answers would be appreciated.
Make it equal to 0?
int i = 200;
// ...
i = 0;
This empties the interger t, with error checking to make sure it really is emptied.
Only works on x86 compatible processors though.
Code:int t; __asm { mov cx, 0x003f cpuflag: mov t,0 cmp t,0 je exception loop cpuflag exception: }
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
As long as a variable "exists" and as long as it is in scope, it has to have some value. It can contain zero, but I wouldn't call a numerical variable "empty". Variables "point to" physical memory (probably a bad choice of words because we're not talking about pointers.) That physical memory has some binary number in it... maybe zero!
C++ finds the end of a string by looking for the first NULL (zero). So a string that starts with NULL (often expressed as '\0') will be treated as "empty" and will have a length of zero.