C で 2 次元配列を設定しようとしています。すべてうまくいきますが、配列に割り当てられた値が出力されません。
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
main()
{
char parkingspace[25][4];
char CarReg[7], validreg[7];
int row, position;
printf( "Enter the car Registration number \n" );
fgets( CarReg, sizeof( CarReg ), stdin );
if( isdigit( CarReg[0] )&& isdigit( CarReg[1] ) && (CarReg[2]=='H' ) && ( CarReg[3]=='I' ) && ( CarReg[4]=='R' ) && ( CarReg[5]=='E' ))
{
puts( "Valid Registration \n" );
printf( "==================================================\n\n\n" );
}
else
{
puts( "Invalid registration .\n Please put a value of two digits followed by the word HIRE! in caps" );
}
printf( "You entered: %s\n", CarReg );
if( isdigit( CarReg[0] )&& isdigit( CarReg[1] ) && ( CarReg[2]=='H' ) && (CarReg[3]=='I' ) && ( CarReg[4]=='R' ) && ( CarReg[5]=='E' ))
{
strcpy(validreg, CarReg);
printf( "Accepted Car Reg is : %s\n\n\n\n", validreg );
printf( "==================================================\n\n\n");
}
for (row=1; row<26; row++)
{
for (position=1;position<5; position++)
{
parkingspace[row][position]=validreg;
printf("parkingspace \t row[%d] position[%d] =[ %c ]\n", row,position,parkingspace[row][position]);
}
}
}