question about Null character

This is a discussion on question about Null character within the C Programming forums, part of the General Programming Boards category; i wanted to ask like in some codes i see like char !='0' that means or ='0' whats that null ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    12

    question about Null character

    i wanted to ask like in some codes i see like char !='0'
    that means or ='0' whats that null character all about ? srry for my stupid question i m still a begineer.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,981
    '0' is the literal zero character which has the value of 48 in ASCII, not the null character ('\0').
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    12
    yah srry i mean the ('\0') not 0 typing error srry i wanted to ask like u got an array of like 50 element and u do a!='\0' that wont end on 49 ? on the 48 array ?and if u do a='\0' that mean it will end on the 49 element ?srry coz its not very clear for me thanks for ur help in advanced

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,981
    Yes, if you have a char array of 50 characters then the maximum number of characters in the null terminated string is 49. Of course, the first null character can occur anywhere, not just as the last element.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    12
    thanks for help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 05:03 AM
  2. Compiling 3rd party code problem me too
    By siavoshkc in forum C Programming
    Replies: 1
    Last Post: 09-12-2007, 05:55 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21