Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* sscanf example */
- #include <stdio.h>
- int main ()
- {
- char sentence []="Rudolph is 12 years old";
- char str [20];
- char str2 [20];
- int i;
- sscanf (sentence,"%s %s %d",str,str2,&i);
- //str=Rudolph
- //str2=is
- //i=12
- printf ("%s %s -> %dn",str,str2,i);
- return 0;
- }
- /* sscanf example */
- #include <stdio.h>
- int main ()
- {
- char sentence []="5,6,7";
- char str [20];
- char str2 [20];
- int i,j,k;
- sscanf (sentence,"%d %*c %d %*c %d",&i,&j,&k);
- printf ("%d %d %dn",i,j,k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement