NULL is the old C symbol for a null pointer. If you want x to initialized to some default state, then you have to rely on the MyClass default constructor to initialize the objects and its member variables to some suitable default values.
Python Javascript Linux Cheat sheet Contact. We'll send a magic link to your inbox. Email Address. All Sign in options. Enter a Email Address. Choose your interests Get the latest news, expert insights and market research, sent straight to your inbox. Newsletter Topics Select minimum 1 topic. Anonymous February 13, 0 Comments.
Any ideas? Anonymous Posted February 13, 0 Comments. If the pointer size of a platform is 4 bytes, the output of the above program would be 4. But if pointer size on a platform is 8 bytes, the output of the above program would be 8.
What about dereferencing of NULL? Again it depends on a lot of factors. But the idea of mentioning the above snippet is that we should always check for NULL before accessing it.
As per C11 standard clause 6. Even C11 clause 6. Here C11 has mentioned guidelines. From clause 6. So we can conclude on NULL as follows: 1. Always initialize pointer variables as NULL. Always perform a NULL check before accessing any pointer.
Also, please do leave us to comment for further clarification or info. Skip to content. Change Language. Related Articles.
0コメント