Null string assignment

This is a discussion on Null string assignment within the C Programming forums, part of the General Programming Boards category; Just saw this line in some C code and was unfamiliar with the syntax. Can someone explain where I might ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Question Null string assignment

    Just saw this line in some C code and was unfamiliar with the syntax. Can someone explain where I might learn a bit more about the syntax of using the {} in this way?

    Code:
    static char a_null_str[1] = { 0x00 };
    Thanks, --Ray

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Sure you can get that from any C tutorial or book.

    It's called an initializer value...

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,656
    You can initialize an array that way (only at declaration time). Link and link

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    22
    Quote Originally Posted by raybies View Post
    Just saw this line in some C code and was unfamiliar with the syntax. Can someone explain where I might learn a bit more about the syntax of using the {} in this way?

    Code:
    static char a_null_str[1] = { 0x00 };
    Thanks, --Ray
    This shows initialization with null character...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unable to compare string with 'getter' returned string.
    By Swerve in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2009, 06:56 PM
  2. Help Debugging my AVL tree program.
    By Nextstopearth in forum C Programming
    Replies: 2
    Last Post: 04-04-2009, 02:48 AM
  3. Memory leaks problem in C -- Help please
    By Amely in forum C Programming
    Replies: 14
    Last Post: 05-21-2008, 12:16 PM
  4. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  5. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM

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