Hi,
I'm writing a program where user need to enter a command with some parameters. Something like, "please insert your choice:account change 123" where I need to get the "123" inside a integer variable.
I've made some search but I was not able to find any answer. This is what I have so far:
Can someone help me on this?Code:char s[50],ch; int valor[10]; int i,c=0,d=0; printf("Enter any string : "); for(i=0;ch!='\n';i++){ ch=getchar(); printf("-%c",ch); s[i]=ch; } s[i]='\0'; for(i=0;s[i]!='\0';i++){ if(s[i]==' '){ c++; } if(c==2 && s[i]!=' '){ printf("%c",s[i]); valor[d]=s[i]; d++; } } printf("\n\nTotal words are %d",c+1); printf("\n\n are %i", valor);
Thanks for your help.
Regards
SP