topical media & game development

talk show tell print

professional-program-12-Macros-Square.c

? / professional-program-12-Macros-Square.c


  include <iostream>
  using namespace std;
  
  //#define SQUARE(x) ((x) * (x)) // No semicolon after the macro definition!
  define SQUARE(x) (x * x)
  
  int main(int argc, char** argv)
  {
    cout << SQUARE(4) << endl;
    cout << SQUARE(2 + 2) << endl;
  
    return (0);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.