Hi guys i run a program: and i have an error...can sb tell me where i have the mistake?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int myPassword(void){
int p;
printf("Please type a 6 digit password:\n");
scanf("%d", &p);
return p;
}
void Init(char A[][], int B[][][], char C[][][], int nrows){
int choice2, i, key=0;
printf("Please press 1 to have a sit close to a window \n");
printf("Please press 2 to have a sit in the corridor \n");
printf("Please press 3 to have a sit in the middle \n");
scanf("%d", &choice2);
printf("Please type your name:\n");
if(choice2==1){
for(i=0; i<nrows; i++){
if(A[i][0]=='-'){
A[i][0]='*';
key=1;
break;
}
}
if(key==0){
for(i=0; i<nrows; i++){
if(A[i][0]=='-'){
A[i][0]='*';
break;
}
}
}
}
// myPassword(); //Pairnoume ton kwdiko
}
main(){
int nrows, nseat, choice, i, j;
char** A;
char*** C;
int*** B;
printf("How many rows do you want ? \n");
scanf("%d", &nrows);
nseat = (nrows*6);
printf("The seats are %d \n\n", nseat);
/* For the aeroplane seats! */
A = (char**)malloc(nrows*sizeof(char*));
for(i=0; i<nrows; i++){
A[i] = (char*)malloc(6*sizeof(char));
}
for(i=0; i<nrows; i++){
printf("\n");
for(j=0; j<6; j++){
printf("A[%d][%d]: %c ", i, j, A[i][j]);
}
}
/* For the passwords */
B = (int***)malloc(nrows*sizeof(int**));
for(i=0; i<nrows; i++){
B[i] = (int**)malloc(6*sizeof(int*));
for(j=0; j<6; j++){
B[i][j] = (int*)malloc(6*sizeof(int));
}
}
/* For the names */
C = (char***)malloc(nrows*sizeof(char**));
for(i=0; i<nrows; i++){
C[i] = (char**)malloc(6*sizeof(char*));
for(j=0; j<6; j++){
C[i][j] = (char*)malloc(30*sizeof(char));
}
}
printf("\n\n");
while(1){
printf(" Please press 1 to have a reservation \n");
printf(" Please press 2 for reservations search \n");
printf(" Please press 3 for the aeroplane plan\n");
printf(" Please press 4 for the passenger list \n");
printf(" Please press 0 to exit \n");
scanf("%d", &choice);
switch(choice){
case 1:
printf("You are in case 1\n");
Init(A, B, C, nrows); //reservations
break;
case 2:
printf("You are in case 2\n");
break;
case 3:
printf("You are in case 3\n");
break;
case 4:
printf("You are in case 4\n");
break;
case 0:
printf("You are about to exit!\n");
exit(EXIT_SUCCESS);
default:
printf("Please give the right number\n");
break;
}
} // While loop
printf("\n");
system("pause");
}
and the out put is:
Reservations.c:11: error: array type has incomplete element type
Reservations.c:11: error: array type has incomplete element type
Reservations.c:11: error: array type has incomplete element type
Reservations.c: In function ‘main’:
Reservations.c:97: error: type of formal parameter 1 is incomplete
Reservations.c:97: error: type of formal parameter 2 is incomplete
Reservations.c:97: error: type of formal parameter 3 is incomplete
Can sb help me please...