#define question

This is a discussion on #define question within the C Programming forums, part of the General Programming Boards category; Is it possible to #define a value after being scanned in like say if i wanted two values: Code: printf("print ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    34

    #define question

    Is it possible to #define a value after being scanned in like say if i wanted two values:
    Code:
    printf("print two values\n");
    scanf("%i,%i",int1,int2);
    /*check values*/
    
    /*then somehow*/
    #define THING_ONE  int1
    #define THING_TWO int2
    
    /*so then the rest of my program can use the #define sizes*/
    Thanks .

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    #define arguments are "preprocessor" directives. This means before it processes any lines of code, these are processed. So no, it wouldn't work the way you expect.

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

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    34
    aww. Well thanks anyway Quzah

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accessing syscalls from C
    By lilcoder in forum C Programming
    Replies: 17
    Last Post: 09-19-2007, 02:27 PM
  2. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  3. macro (#define) question
    By Darrok in forum C++ Programming
    Replies: 30
    Last Post: 12-20-2001, 04:01 PM
  4. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 05:05 PM

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