Advertisement
cd62131

Split

Feb 21st, 2014
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(void) {
  3.   char a[] = "00 05 10 15 20";
  4.   int b[5], i;
  5.   sscanf(a, "%d%d%d%d%d", &b[0], &b[1], &b[2], &b[3], &b[4]);
  6.   for (i = 0; i < 5; i++) printf("b[%d] = %d\n", i, b[i]);
  7.   char c[] = "00,05,10,15,20";
  8.   int d[5];
  9.   sscanf(c, "%d,%d,%d,%d,%d", &d[0], &d[1], &d[2], &d[3], &d[4]);
  10.   for (i = 0; i < 5; i++) printf("d[%d] = %d\n", i, d[i]);
  11.   return 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement