Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,484 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,732 people online right now. Registration is fast and FREE... Join Now!




Expected primary expression compile error

 
Reply to this topicStart new topic

Expected primary expression compile error

phoenixrisen
6 Mar, 2008 - 04:03 AM
Post #1

New D.I.C Head
*

Joined: 25 Feb, 2008
Posts: 2

There is probably a very simple fix for this, but I keep running into the same compile error when I try to compile this program.

I'm just starting out building a chess program in DevC++ and so, so far, it's very simple code... I just am trying to get the board to initialize.

CODE

int main()
{
    
    InicializarTablero(char* initablero);
    system("PAUSE");
    return EXIT_SUCCESS;
}


The code for the function is:
CODE

void InicializarTablero(char* initablero)
{
    int fila, columna;
    
    cout << "=====================================" << endl;
    for (fila = 0; fila < 7; fila++)
    {
        cout << 8 - fila << " ";
        for (columna = 0; columna < 8; columna++)
        {
            cout << " | " << initablero[fila][columna];
        }
        cout << " |" << endl;
        cout << "   ----------------------------------" << endl;
    }
    for (fila = 7; fila < 8; fila++)
    {
        cout << 8 - fila << " ";
        for (columna = 0; columna < 8; columna++)
        {
            cout << " | " << initablero[fila][columna];
        }
        cout << " |" << endl;
    }
    cout << "=====================================" << endl;
    cout << "     a   b   c   d   e   f   g   h   " << endl;
}


Every time I compile it I get an error saying "Expected primary expression before "char", in reference to the first line of code in the main() function.

Any ideas?
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Expected Primary Expression Compile Error
6 Mar, 2008 - 06:54 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 39 times
Dream Kudos: 25
My Contributions
CODE

InicializarTablero(char* initablero);
[code]
should be
[code]
InicializarTablero(initablero);

where initablero is a variable of type char*...a further problem is that you do not seem to have declared a variable of that type and name.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 07:13PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month