Thread: Newbie C programming questions

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    33

    Newbie C programming questions

    I know programming in java , but I need some help in c department.
    I am working on a code, the code exists so i need to read it udnerstand it and improve it.

    so i need some answers on small things

    for ex.
    char temp[17];
    temp[0] = 0x00;

    What does this stand for? the bolded one.Thank you

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Hint: 0x is the prefix to designate a hexadecimal integer literal.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    33
    Okey,so it's just the hex encoding of 0.


    So why not temp[0] = 0 ?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Maybe the author is dealing with bits in that part of the code and used hex notation for the other constants, and thus decided that writing 0x00 would be stylistically consistent. Or maybe the author wanted to confuse people who don't know about the notation
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    33
    okey thanks, I will come up with more questions I see in the coding.

    I just bump the thread later

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 11-09-2011, 03:48 PM
  2. Newbie questions
    By Black_Epiphany in forum C Programming
    Replies: 5
    Last Post: 09-23-2011, 07:39 PM
  3. Im a newbie to C and i have some questions
    By pave1104 in forum C Programming
    Replies: 5
    Last Post: 07-05-2006, 09:48 PM
  4. Newbie IO questions
    By gustavosserra in forum C Programming
    Replies: 5
    Last Post: 08-29-2003, 08:09 AM
  5. c++ newbie questions
    By dune911 in forum C++ Programming
    Replies: 2
    Last Post: 09-14-2001, 06:30 AM