Thread: Structure difficulties

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    49

    Structure difficulties

    I get the error message: dereferencing pointer to incomplete type
    for every line where i use the code line: pointer->variableinstructure

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    
    struct OUTPUT_DATA 
    {
           int C_num; 
           int P_num; 
           int B_num; 
           float Prix_C; 
           float Prix_B; 
           float Prix_P;
    };
    
    void Output_Data(struct OUTPUT_DATA *);
    
    int main()
    {
          //All my variables are declared, i double checked....
    
          struct OUTPUT_DATA NUM_COST;
         
          NUM_COST.C_num = ((sortieHeureMaxPanneaux / eff_conv) / 5) + 1;
          NUM_COST.B_num = ((Besoin / eff_conv) / 4.8) + 1;
          NUM_COST.P_num = Aire + 1;
          
          NUM_COST.Prix_C = NUM_COST.C_num * C$;
          NUM_COST.Prix_B = NUM_COST.B_num * B$;
          NUM_COST.Prix_P = NUM_COST.P_num * P$;
    
          Output_Data(NUM_COST);
    
          system("PAUSE");
          return 0;
    }
    
    void Output_Data(struct OUTPUT_DATA *NUM_COSTptr)
    {
          char article[3][29] = {"Batteries (4.8 V)","Convertisseurs (5 KW)","Panneaux photovoltaique (m^2)"};
          float $Total;
          
          printf("\nAfin d’installer un bloc d’alimentation &#233;lectrique photovolta&#239;que &#224; panneaux plats pour l’utilisation r&#233;sidentielle &#224; Ottawa, ON, vous aurez besoin de:\n\n");
          printf("&#37;d %s = %f", NUM_COSTptr->B_num, article[0], NUM_COSTptr->Prix_B);
          printf("\n%d %s = %f", NUM_COSTptr->C_num, article[1], NUM_COSTptr->Prix_C);
          printf("\n%d %s = %f", NUM_COSTptr->P_num, article[2], NUM_COSTptr->Prix_P);
          
          $Total = NUM_COSTptr->Prix_B + NUM_COSTptr->Prix_C + NUM_COSTptr->Prix_P;
          
          printf("\n\nCouts total: %f", $Total);
    }
    Last edited by Tyrant; 11-18-2007 at 01:29 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem referencing structure elements by pointer
    By trillianjedi in forum C Programming
    Replies: 19
    Last Post: 06-13-2008, 05:46 PM
  2. Replies: 5
    Last Post: 02-14-2006, 09:04 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. C structure within structure problem, need help
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-30-2001, 05:48 PM