error C2059: syntax error : '('

This is a discussion on error C2059: syntax error : '(' within the C Programming forums, part of the General Programming Boards category; Why do I get this error? Code: do{ (linia_tren->dades_parades)++; }while(strcmp(parada1, (*linia_tren).(*dades_parades).nom_parada) != 0 && strcmp(parada2, (*linia_tren).(*dades_parades).nom_parada) != 0); Here there ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    52

    error C2059: syntax error : '('

    Why do I get this error?

    Code:
     
    do{
    				       (linia_tren->dades_parades)++;
    }while(strcmp(parada1, (*linia_tren).(*dades_parades).nom_parada) != 0  && strcmp(parada2, (*linia_tren).(*dades_parades).nom_parada) != 0);
    Here there are the types declarations:
    Code:
    typedef struct
    {
       char nom_parada[MAX_NOM];
       int distancia_anterior;
       int temps_anterior;
    } parada;
    
    typedef struct
    {
       char nom_linia[MAX_NOM];
       int n_parades;
       parada *dades_parades;
    } linia;
    And variables

    Code:
    char nom_linia [MAX_NOM], parada1 [MAX_NOM], parada2 [MAX_NOM];
       linia *linia_tren;

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,616
    Instead of:
    Code:
    (*linia_tren).(*dades_parades).nom_parada
    you probably wanted to write:
    Code:
    linia_tren->dades_parades->nom_parada
    or if you insist on the longer version:
    Code:
    (*(*linia_tren).dades_parades).nom_parada
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21