问题求教,关于数组初始化。
char *line1[LINE_ANZHAL][LINE_LANGE];//pins
strcpy(line1[1][LINE_LANGE],"//-*-verilog-*-\n");
strcpy(line1[2][LINE_LANGE],"`timescale 1ns / 1ps\n");
strcpy(line1[3][LINE_LANGE],"module test;\n");
strcpy(line1[4][LINE_LANGE]," parameter simulator=\"spectre\"; //;\n");
strcpy(line1[5][LINE_LANGE]," parameter model=\"slow\";\n");
if ((fp1=fopen(name,"w"))==NULL)
{
printf ("Datei kann nicht erzeugt werden\n");
exit (-1);
}
else
{
fputs (*line1[1],fp1);
fputs (*line1[2],fp1);
fputs (*line1[3],fp1);
fputs (*line1[4],fp1);
fputs (*line1[5],fp1);
//pins
请问上面关于line1数组的定义和使用那地方不对。为什么有warning C4700: local variable 'line1' used without having been initialized ?而且运行结果也不对。
请问这个数组应该怎么初始化呀?
----------------解决方案--------------------------------------------------------
strcpy(line1[0],"//-*-verilog-*-\n");
strcpy(line1[1],"`timescale 1ns / 1ps\n");
----------------解决方案--------------------------------------------------------
char line1[LINE_ANZHAL][LINE_LANGE];
----------------解决方案--------------------------------------------------------