Click here to Skip to main content
15,896,444 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
#include<stdio.h>
#include<conio.h>
#include<string.h>

int temp1[3][3];
void main()
{
char ch[4];
FILE *fin;
int i,j;
int n;
clrscr();
fin=fopen("input.in","rb");
fscanf(fin,"%d",&n);
printf("%d\n",n);
for(j=0;j<n;j++)
{
fscanf(fin,"%s",ch);
strcpy(temp1[j],ch);
}
printf("%c",temp1[2][2]);
getch();
}
Posted

1 solution

Quote:
strcpy(temp1[j],ch);
The above line doesn't make sense. Why are you copying a string into an array of integers?

Moreover, please remeber to always return value of the C runtime functions (like fopen and scanf).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900