constant defined using connst int and #define

Discussion in 'Software' started by prati, Oct 27, 2012.

  1. prati

    prati

    Joined:
    Aug 2, 2012
    Messages:
    1
    Suppose i have defined a constant as const int MAX =5 and i am using it in a function called find().


    void find()
    {

    if(MAX==5)
    {
    //do this
    }
    else
    {
    //do this
    }
    }

    if i am calling this function for 100 of times then which way is better to define a constant as i can define a constant in 2 ways.
    1 const int MAX=5
    2.#define MAX 5
    prati, Oct 27, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nsmurthy
    Replies:
    0
    Views:
    735
    nsmurthy
    Aug 13, 2004
  2. wineguyatl@hotmail.com
    Replies:
    1
    Views:
    1,662
    wineguyatl@hotmail.com
    Nov 18, 2003
  3. Nomen Nescio
    Replies:
    0
    Views:
    442
    Nomen Nescio
    May 17, 2004
  4. avraham shir-el
    Replies:
    4
    Views:
    8,523
    avraham shir-el
    Jul 20, 2004
  5. joe@via.net
    Replies:
    2
    Views:
    519
    Walter Roberson
    Jan 16, 2005
Loading...

Share This Page