I have a problem with sscanf function...
Here is my code :
char str[]="Andrew;;;3454";
char name[20] = {0};
char city[20] = {0};
char age[5] = {0};
char hasDegree[20] = {0};
sscanf(str,"%[^;];%[^;];%[^;];%[^;]",name,city,age,hasDegree);
printf("%s is %s Years Old and live in %s at %s degrees",name,age,city,hasDegree);
The output : Andrew is Years Old and live in at degrees
As you can see, "Andrew" is printed but not "3454" (because there are 2 blank before?)
How to solve it please?
I have declared everything in char voluntarily :)
Thank you !