Please help me:
Following is my program:
main()
{
char str[] = "This is //20";
char c[10], *k;
int num=0;
sscanf(str, "%s%[^//]*//%d",c, &num);
printf("%s \n %d \n", c, num);
}
My intention is to get the first string and last number. I want to ignore the remaining text. There is chance of having the number in middle of the string also, but the number starts with //.
Following are the possible strings that I can use as input strings:
This is //20
This is //kandarpa //20
This is //20 //kandarpa
This is
The string consists at most one number only.