This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

#define COUNT 2000

can any one give me the meaning of following line

#define COUNT  2000
#define KEY2    0x2F
#define KEY1    0xF8

COUNT,KEY2,KEY1 are the name's given which we going to use next in the prog. but what is 2000,0x2F,0xF8 is address i.e memory location or simply just value.

Parents Reply Children
  • #define COUNT 2000
    it mean's when ever the COUNT appears replace it with 2000

    Correct!

    #define val 0x0f
    it mean's when ever the val appears goto the memory location 0x0f and pop-up the value

    No!!
    It has exactly the same meaning as in the first example!

    It means purely and simply that wherever val appears it will be replaced with 0x0f

    eg,

    #define val 0x0f
    
    int fred;
    int array[16];
    
    fred = val;      // assigns the value 15 to fred
    
    array[val] = 3;  // assigns the value 3 to array[15]
    
    if( fred > val ) // Tests if the value of fred is greater than 15
    


    Remember, 0x0F (hex) is 15 (decimal)