Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- int main()
- {
- char *str = "Tom 28";
- char name[10];
- int age, ret;
- printf("str= %sn", str);
- ret = sscanf(str, "%s %d", name, &age);
- printf("Name: %sn", name);
- printf("Age: %dn", age);
- str[12] = '5';
- printf("str= %sn", str);
- ret = sscanf(str, "%s %d", name, &age);
- printf("Name: %sn", name);
- printf("Age: %dn", age);
- exit( 0 );
- }
- str= Tom 28
- Name: Tom
- Age: 28
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement