#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void Read_str(char a[][10],int b);
void Print_str(char a[][10],int b);
int main(void) {
int b1;
printf("insert number of string: ");
fflush(stdout);
scanf("%d",&b1);
char a1[b1][10];
Read_str(a1,b1);
Print_str(a1,b1);
return EXIT_SUCCESS;
}
void Read_str(char a[][10],int b){
int i;
for(i=0;i<b;i++)
{
printf("insert string%d",i+1);
fflush(stdout);
scanf("%s",&a[i][10]);
}
}
void Print_str(char a[][10],int b){
int i;
for(i=0;i<b;i++)
{
printf("string number%d= %s\n",i+1,a[i]);
fflush(stdout);
}
}
this all of cod that i wrote.get some string and print them.
please check this code.when i write this
scanfscanf("%s",&a1[i-1][10]);
the code work good.but when i write this
scanf("%s",&a1[i][10]);
the code did not work good.for example for b1==3 the code did not work .