Question:
NULL is a Keyword in C++?
Utsav
2010-04-04 23:55:35 UTC
NULL is a Keyword in or something else in C++.
Please give me detail.
Thanks in Advance
Six answers:
2010-04-05 00:00:13 UTC
The null keyword in java programming language is a reserved word that is used to represent no value. Keywords are basically reserved words which have specific meaning relevant to a compiler.



Syntex: Here is the syntax that displays how to declare and define null values in java programming language.



SQL Alter Column Not Null

Mysql Alter Not Null

JDBC Insert Null

Php Sql Null

Mysql Alter Allow Null

SQL NOT NULL Constraint
2010-04-05 00:09:12 UTC
NULL - a special constant value that represents a null pointer. and null pointer - a pointer value that evaluates to zero.



C++ supports symbolic constants. The NULL keyword should be avoided because it's meaning differs between systems. Some systems define NULL as 0, others define it as ((void*)0) This isn't an issue in C, but the more strict type checking in C++ causes problems here.



If there's a system which #defines NULL as (void*)0 for C++ then it's broken. Uses of NULL simply wouldn't even compile then, as C++ doesn't allow converting void* to T* without an explicit cast. Properly #defined NULL for C++ is either 0 (or 0L or some other kind of 0) or something like gcc's __null. In either case it's at least as good as using plain 0.





http://www.cplusplus.com/query/search.cgi?q=null

http://discuss.joelonsoftware.com/default.asp?design.4.195262.19
oops
2010-04-05 00:07:29 UTC
It's not a keyword, but it is defined throughout the standard library as 0. Try writing a program that uses NULL, but doesn't include any headers, it shouldn't compile.
Jim
2010-04-05 21:53:10 UTC
I believe it is, but if you want to be sure, you would have to buy a $62 book called The C++ Programming Language and read through the BNF grammar. I haven't had one of these books in a long time (would be nice to have an updated version not that the STL exists and has TR1 in it).



from what I remember it is not defined in any headers.
Erika
2016-12-01 12:32:48 UTC
nicely, you're able to do it in case you pick for. in simple terms make beneficial that if there are the different guidance around additionally pointing to that merchandise, they arise to date as nicely and/or is in simple terms no longer utilized in an risky way. That stated, the technique as you enormously have it set up there probable won't artwork, with the aid of fact the pointer is being handed in with the aid of cost, no longer with the aid of reference. placing the close by pointer to null is nearly pointless (no pun meant).
shiva
2010-04-05 00:33:05 UTC
Null pointer



This macro expands to a null pointer constant.



A null pointer is generally used to signify that a pointer does not point to any object.

In C++, NULL expands either to 0 or 0L.





http://www.cplusplus.com/reference/clibrary/cstring/NULL/


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...