I am trying to copy same characters from an single dimensional char array to each row of a 2d array,but I cant any output.
Expected output:
abcd
abcd
abcd
abcd
Output I got:
process returned -1073741819(0xC0000005) execution time : 4.583s
press any key to continue
Here's the code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int i,j;
char v[4]={'a','b','c','d'};
char answers[10][10];
for(i=0;i<4;i++){
for(j=0;j<4;j++){
strcpy(answers[i][j],v[i]);
}
}
for(i=0;i<4;i++){
printf("\n%s",answers[i]);
}
getch();
}