hi guys,
i have a variable like this:
may &cfgReg be NULL?Code:ULONG cfgReg=0;
it wont happen usually but in a very extreme situation? if there is no memory for 64bits?
Printable View
hi guys,
i have a variable like this:
may &cfgReg be NULL?Code:ULONG cfgReg=0;
it wont happen usually but in a very extreme situation? if there is no memory for 64bits?
In this case, taking the address of a declared variable, you should never get a NULL address as the address is either on the stack (if you run out of stack space you have other problems) or in the data section of the code. Memory allocation has nothing to do with it.
> may address of a variable be null
No.
I totally agree with Salem,
Variable decleared cannot be without address.
You can have pointer and initalied to NULL.
like, int *p=NULL;
which would mean the p is a pointer to int but is not pointing to anything .
then can i declare millions billions of variables and run them?
cant system reject your request?
If you've got enough stack space, sure. Otherwise, as long as you have enough ram and/or hard disk(swap) space to keep making variables dynamically, sure. Otherwise you'll run out of memory and malloc will fail and tell you as much.
Quzah.