Thread: MaCRo problem

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    11

    MaCRo problem

    What am i doing wrong here? the commented out code causes the following errors.

    error C2143: syntax error : missing ')' before ';'
    error C2143: syntax error : missing ']' before ')'
    error C2143: syntax error : missing ';' before ')'
    error C2059: syntax error : ')'
    error C2059: syntax error : ']'
    error C2143: syntax error : missing ')' before ';'
    error C2059: syntax error : ']'


    Code:
    #include<iostream>
    #define SIZE 2;
    using namespace std;
    
    int ray[2][2];
    //int ray[SIZE][SIZE];
    int main() {
    }

    Thanx

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    You are putting a semi colon in your #define.

    Since you are using C++, consider using a const.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    The larch
    Join Date
    May 2006
    Posts
    3,573
    This macro replaces each occurrence of the token SIZE with 2;, resulting in

    Code:
    int ray[2;][2;];
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem in macro
    By Bargi in forum C Programming
    Replies: 17
    Last Post: 02-04-2009, 10:17 AM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM