can u see y the output of this program is very wrong? imagine u input a name and a telephone number only, and u tell the program to input s1, s2 and s3.. it will give u a lot of symbols after the telephone number! :S:S any help?
and also how can i then get the numbers to be saved in an array? how can i do that? 10x
CODE
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int i, j;
int main (void)
{
char* s[2][100];
char* n[2][100];
//char* s = "[Gordon Camilleri ][5432][, ] [13] [th may][2006] [ Street, Fgura FGR][123][; ][21212121]
//char* s = "[Gordon Camilleri ][5432][, Borg Street, Fgura FGR][123][; ] [21212121]
// s1 s2 s3 s4 s5 s6 s7 s8 s9 s10
char s1[100],s2[100],s3[100],s4[100],s5[100],s6[100],s7[100],s8[100],s9[100],s10[100];
int x;
for(i=0;i<2;i++)
{
printf ("Enter Name, Address and Phone : ");
gets(s[i]);
printf("\n");
}
for(i=0;i<2;i++)
{
sscanf(s[i], "%[^0123456789]%[0123456789]%[^0123456789]%[0123456789]%[^0123456789]%[0123456789]%[^0123456789]%[0123456789]%[^0123456789]%[0123456789]",
s1 ,s2 ,s3 ,s4 ,s5 ,s6 ,s7 ,s8 ,s9 ,s10);
//printf("NAME\t\t\tTELEPHONE NUMBER\n");
printf("%s\n%s\n%s\n\n", s1,s2,s3);
}
return (0);
}