CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: scope

  1. #1
    Join Date
    Aug 2005
    Location
    southampton, UK
    Posts
    1,320

    scope

    Code:
    struct card {
           bool l;
    };
    
    bool pair(card[] cards) {
         
         return true;
    }
    here i get the error: expected primary-expression before ']' token

    why is this?

  2. #2
    Join Date
    Mar 2004
    Location
    Israel
    Posts
    638

    Re: scope

    change
    bool pair(card[] cards)
    into
    bool pair(card cards[])
    **** **** **** **** **/**

  3. #3
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725

    Re: scope

    you just have the [] in the wrong location ...

    Code:
    bool pair(card cards[]) {
         
         return true;
    }

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: scope

    The parameter declaration "card[]" is invalid. The array indicator is in the wrong place:
    Code:
    bool pair(card cards[])
    Viggy

  5. #5
    Join Date
    Feb 2002
    Posts
    4,640

    Re: scope

    Now that's pretty funny (2 responses at the same time; 1 minute late)!

    Viggy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured