Thread: I want to share in your knowlegde

  1. #1
    Registered User zergdeath1's Avatar
    Join Date
    Sep 2003
    Posts
    39

    Question I want to share in your knowlegde

    Ok I have a lot of questions about C and I was hoping that you would help me answer them I you could would please do so as this is probably cofusing others to thanks:

    1. Why does C have so many ways to input numbers, int, float, double, char, signed, unsigned, etc...

    2. Do i really need to memorize all of them and there related features early in programming?

    3. What is the differance between signed and unsigned? Is it really nessecery?

    4. I do not understand the CHAR funtion at all could you explain it to me? or tell me what use it is i meen it doesnt seem to have a purpose.

    5. Are all of the above things neccessary to know how to program?

    Thanks for Helping me.

    I would also like help understanding octal, hexidecimal #s:

    1. What is the differance?

    2. Can you help me learn how to read and convert to and from them?

    3. Do I need to know them for C?

    4. Any other information about these...?

    5. Do you know of any websites that might help me understand Octal or hexidecimal numbers?

    Please if you can thank you?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: I want to share in your knowlegde

    >>1. Why does C have so many ways to input numbers, int, float, double, char, signed, unsigned, etc...
    Because it does. It's useful to be able to store different number types.

    >>2. Do i really need to memorize all of them and there related features early in programming?
    Memorise, probably not. Understand and be aware, yes. With practice, you'll find you remember them all anyway without too much effort.

    >>3. What is the differance between signed and unsigned? Is it really nessecery?
    Difference is that signed ints use a single bit to denote the positive/negative sign. Unsigned ints don't as they're always deemed to be positive. Therefore they are free to use that extra bit in their number storage, which makes them able to store higher numbers than signed ints. Is it necessary, yes.

    >>4. I do not understand the CHAR funtion at all could you explain it to me? or tell me what use it is i meen it doesnt seem to have a purpose.
    There is no "CHAR function". Can you explain your question better.

    >>5. Are all of the above things neccessary to know how to program?
    It depends on what you're programming. You don't use all elements of the language all of the time, but you should be aware of what there is available. Memorising the complete language isn't a requirement, but a conceptual understanding of most of it is, in the long term.

    >>octal, hexidecimal #s
    >>1. What is the differance?
    They are different ways to represent the same number.

    >>2. Can you help me learn how to read and convert to and from them?
    http://www.google.com/search?hl=en&l...ecimal&spell=1
    Google is always good for finding these types of things.

    >>3. Do I need to know them for C?
    It's better to, but not essential, imo. You don't need to know the maths behind converting one to another, that's what calculators are for.

    >>5. Do you know of any websites that might help me understand Octal or hexidecimal numbers?
    www.google.com
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    root
    Join Date
    Sep 2003
    Posts
    232
    1a) Because there are so many numbers. Next!

    2a) Nope, it comes with time. Most experts have a reference handy at all times too. Next!

    3a) Signed can hold a negative value, unsigned can't. But unsigned can hold larger positive values. Next!

    4a) char is a type, not a function. It's a little integer that is used to represent printable characters. There are little nuances, but you don't need to worry about them until later. Next!

    5a) No. Shell scripting is just saving a bunch of shell commands to a file and making it executable. But shell scripting is considered programming. Next!

    1b) Each one prints out differently. Next!

    2b) It's all binary at the bottom, but you can use printf's formatting flags to change how a value is printed. %o is octal, %x is hexadecimal, and %d is decimal. No, there's no flag for binary. Next!

    3b) Not at first, but later on it couldn't hurt. Next!

    4b) www.google.com

    5b) www.google.com
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    For the programming you're going to do early on, you're only really going to use int and double. If it's an integer, use int. If it's a number that you want to be able to hold decimal values, use double.

    The rest is basically just size differences. The reserved words short and long are just what they say they are. Unless you're working with really big numbers or are under some serious size constraints, that isn't really essential for you. I suggest that you now focus on learning other concepts like loops, arrays, pointers, classes, etc.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 03-08-2008, 05:42 AM
  2. Everybody share your site
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-28-2004, 11:13 AM
  3. Can multiple linked lists share the same structure?
    By passy in forum C Programming
    Replies: 10
    Last Post: 08-28-2003, 04:38 PM
  4. C++ Share Interface Problem
    By Morphios in forum C++ Programming
    Replies: 0
    Last Post: 04-28-2003, 07:30 PM