473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Whether NULL character is same as space char? If not then what exactly a NULL ll do

I know that null character have ascii value of 0 and space as 32.My question is what a NULL character will do.How to define it?
Dec 9 '10 #1

✓ answered by Raj K

Both are completely different. The space char is used for displaying space between characters that you see. This is used mostly for visual purpose.
While the NULL is mostly used to find out the end of the string or end of some data. The NULL has many other uses in programming.



-RajX
__________________________________________________ ___
C++ Internals: http://www.avabodh.com/cxxin/cxx.html

5 10708
Raj K
9
Both are completely different. The space char is used for displaying space between characters that you see. This is used mostly for visual purpose.
While the NULL is mostly used to find out the end of the string or end of some data. The NULL has many other uses in programming.



-RajX
__________________________________________________ ___
C++ Internals: http://www.avabodh.com/cxxin/cxx.html
Dec 9 '10 #2
Raj K
9
The NULL can be defined as
Expand|Select|Wrap|Line Numbers
  1.  #ifndef NULL
  2.        #ifdef __cplusplus
  3.        #define NULL    0
  4.        #else
  5.        #define NULL    ((void *)0)
  6.        #endif
  7.        #endif
  8.  



-RajX
__________________________________________________
C++ Internals: http://www.avabodh.com/cxxin/cxx.html
Dec 9 '10 #3
weaknessforcats
9,208 Expert Mod 8TB
NULL is a macro.

You would need to look in your C header file to find out what it is. I expect it's an int 0 though it could be a char 0. Look for a #define NULL in your C header.

NULL us used in C but not C++ to avoid having hard-coded values in the code. When you see NULL in C++ you know it's a C programmer trying to use a C++ compiler.
Dec 9 '10 #4
donbock
2,426 Expert 2GB
Null is the character '\0'. One of its uses is to terminate strings.

NULL is a pointer value.

There is no relationship between the null character and the NULL pointer other than the unfortunate coincidence that their names are only distinguishable by how they are capitalized.
Dec 9 '10 #5
Thanks to all for spending time to reply my question..
Dec 10 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Greg.Harabedian | last post by:
I'll start off by saying I am using MySQL v4.0 and my question is...how do I get mysqldump to dump the actual binary values store in a blob? Here is an example: -- Create a test table create...
13
by: Chapman | last post by:
Some questions about strings: this is the extracted piece of my test code: /** **/ char *arry; arry = malloc(30*sizeof(arry)); arry = 'B'; arry = 'S'; arry = 'c';
9
by: Erik Leunissen | last post by:
L.S. I've observed unexpected behaviour regarding the usage of the '#' flag in the conversion specification in the printf() family of functions. Did I detect a bug, or is there something wrong...
15
by: ehabaziz2001 | last post by:
Hi, Till now I do not understand how the null character automatically added to the end of the string and it is not an element of the string array . All books said the null character (\0) added...
6
by: Vinayak Raghuvamshi | last post by:
Visual Studio .Net 2003 Enterprise Architect. (VC++ code) a developer in our team made a typo and his code looks like this if (sendMessage == NULL) m_ErrorCode = 0 ERR_MESSAGE_EMPTY; But...
4
by: Vikas Rana | last post by:
Hi all, I am a bit confused about the method java.sql.DatabaseMetaData.nullsAreSortedHigh(). What exactly does this return? If this returns true, are nulls considered as the highest value? Or...
1
by: asenthil | last post by:
Hai, i had tried to write a string which is fetched from a database into a file.... Here are my codings to write that fetched string into a text file... HANDLE hFile; DWORD wmWritten;...
14
by: mast2as | last post by:
Hi everyone, I am trying to implement some specs which specify that an array of parameter is passed to a function as a pointer to an array terminated by a NULL chatacter. That seemed fairly easy...
8
by: Gary | last post by:
When you declare an array of chars and store a string in it, where is the position of the null character \0? And what happens to the unused memory locations? #include <stdio.h> int main(void)...
4
by: jameskuyper | last post by:
mkeles84 wrote: The other responses you've received have explained why 'name' needs to contain a Null-Terminated Character String (NTCS). However, it occurred to me that you might not be aware...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.