Thread: negative integer?

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    29

    Post negative integer?

    Code:
    #define MY_SYMBOLIC_CONSTANT 4
    
    mystructure.member = (Int16)-(MY_SYMBOLIC_CONSTANT-1)
    Is 'mystructure.member' simply the negative integer minus three i.e. -3


    Note: 'Int16' is a typedef of 'signed int'
    Last edited by cblix; 11-08-2005 at 11:20 AM.
    Disk space: the final frontier

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Why don't you test it yourself?
    Code:
    printf("%d\n", -(4-1) );
    See how hard that was? Or wait, here's an even harder method!
    Code:
    printf("%d\n", mystructure.member );

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    29
    It's part of a huge project, just wanted to be really sure. Anyway, I can confirm the above code is -3
    Disk space: the final frontier

  4. #4
    Super Moderator Harbinger's Avatar
    Join Date
    Nov 2004
    Posts
    74
    > It's part of a huge project
    If you can't figure this one line out yourself, the huge project will be beyond you.
    Try eating a mouse before you try eating an elephant.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  2. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  3. Looking for constructive criticism
    By wd_kendrick in forum C Programming
    Replies: 16
    Last Post: 05-28-2008, 09:42 AM
  4. No Match For Operator+ ???????
    By Paul22000 in forum C++ Programming
    Replies: 24
    Last Post: 05-14-2008, 10:53 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM