Error Array Type Has Incomplete Element Type C
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and error array type has incomplete element type struct policies of this site About Us Learn more about Stack Overflow the array type has incomplete element type extern struct company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Array Has Incomplete Element Type 'char '
Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes
Array Type Has Incomplete Element Type Char
a minute: Sign up GCC: array type has incomplete element type up vote 14 down vote favorite 4 I have declared a struct, and I try to pass an array of those structs (as well as a double array of doubles, and an integer) into a function. I get an "array type has incomplete element type" message from gcc when I compile type of formal parameter 1 is incomplete c it. What have I got wrong in how I pass the struct into the function? typedef struct graph_node { int X; int Y; int active; } g_node; void print_graph(g_node graph_node[], double weight[][], int nodes); I have also tried struct g_node graph_node[], but I get the same thing. c arrays gcc struct share|improve this question asked Apr 4 '12 at 0:15 Josh 94021632 Are you absolutely positive the struct declaration comes before the function prototype? –Platinum Azure Apr 4 '12 at 0:26 add a comment| 2 Answers 2 active oldest votes up vote 17 down vote accepted It's the array that's causing trouble in: void print_graph(g_node graph_node[], double weight[][], int nodes); The second and subsequent dimensions must be given: void print_graph(g_node graph_node[], double weight[][32], int nodes); Or you can just give a pointer to pointer: void print_graph(g_node graph_node[], double **weight, int nodes); However, although they look similar, those are very different internally. If you're using C99, you can use variably-qualified arrays. Quoting an example from the C99 standard (section §6.7.5.2 Array Declarators): void fvla(int m, int C[m][m]); // valid: VLA w
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Array Has Incomplete Element Type 'char ' C++
policies of this site About Us Learn more about Stack Overflow the company incomplete array Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users array has incomplete element type 'int []' c++ Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a http://stackoverflow.com/questions/10003270/gcc-array-type-has-incomplete-element-type minute: Sign up C Compile Error: array type has incomplete element type up vote 3 down vote favorite #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have http://stackoverflow.com/questions/10395054/c-error-array-type-has-incomplete-element-type Meta Discuss the workings and policies of this site About Us Learn http://www.dreamincode.net/forums/topic/229366-functions-with-2d-arrays-problem/ more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like has incomplete you, helping each other. Join them; it only takes a minute: Sign up C error: array type has incomplete element type up vote 3 down vote favorite 1 I'm trying to compile a program in Ubuntu 11.04 that works well in Windows but it gives the above error. I have added a comment to the line has incomplete element that is causing the error. Here's the code: route_input() { int num_routes;//Variable to act as the loop counter for the loop getting route details int x; char route_id[3]; char r_source[20]; char r_destination[20]; int r_buses; printf("Please enter the number of routes used: \n"); scanf("%d", &num_routes); char routes_arr[num_routes][10];//An array to hold the details of each route printf("\nNumber of routes is %d\n", num_routes); struct route r[num_routes];//An array of structures of type route (This line causes the error) fflush(stdin); for (x = num_routes; x > 0; x--) { printf("\nEnter the route number: "); scanf("%s", r[x].route_num); printf("Route number is %s", r[x].route_num); printf("\nEnter the route source: "); fflush(stdin); scanf("%s", r[x].source); printf("Source = %s", r[x].source); printf("\nEnter the route destination: "); fflush(stdin); gets(r[x].destination); printf("Destination = %s", r[x].destination); printf("\nEnter the number of buses that use this route: "); scanf("%d", &r[x].num_of_buses); printf("Number of buses = %d", r[x].num_of_buses); } for (x = num_routes; x > 0; x--) { printf("\n\n+++Routes' Details+++\nRoute number = %s, Source = %s, Destination = %s, Number of buses for this route = %d\n", r[x].route_num,
New Topic/Question Reply 12 Replies - 5529 Views - Last Post: 26 April 2011 - 12:13 PM Rate Topic: #1 theGameMaster New D.I.C Head Reputation: 0 Posts: 5 Joined: 26-April 11 Functions with 2d arrays problem Posted 26 April 2011 - 06:59 AM I am trying to write a code so I can have a function to read a 2d array from the user and another function to print out the 2d array, but when I do this I get all these errors: program1.c:5: error: array type has incomplete element type program1.c:6: error: array type has incomplete element type program1.c: In function ‘main’: program1.c:16: error: type of formal parameter 1 is incomplete program1.c:18: error: type of formal parameter 1 is incomplete cc1: warnings being treated as errors program1.c:13: error: ignoring return value of ‘scanf’, declared with attribute warn_unused_result program1.c: At top level: program1.c:23: error: array type has incomplete element type program1.c:33: error: array type has incomplete element type I have no idea what these errors mean and would really appreciate it if someone explains this to me and tells me how i can fix it, here is the code: #include