Guest User

Untitled

a guest
Jan 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. "123 35 123 0 0 0 817 0 0 0 0"
  2.  
  3. int a, b, c;
  4. if( sscanf(string, "%d %d %d", &a, &b, &c) == 3)
  5. printf("the third number is %dn", c);
  6.  
  7. int a;
  8. if( sscanf(string, "%*d %*d %d", &a) == 1)
  9. printf("the third number is %dn", a);
  10.  
  11. const char *input = "...";
  12. int value;
  13.  
  14. // here we use the '*' modifier to discard the input from our string
  15. sscanf("%*i %*i %i", &value);
  16.  
  17. // value now magically has the value you need.
Add Comment
Please, Sign In to add comment