Thread: Null string assignment

  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
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    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, 05:56 PM
  2. Help Debugging my AVL tree program.
    By Nextstopearth in forum C Programming
    Replies: 2
    Last Post: 04-04-2009, 01:48 AM
  3. Memory leaks problem in C -- Help please
    By Amely in forum C Programming
    Replies: 14
    Last Post: 05-21-2008, 11:16 AM
  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