×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: C
Posted by: Shamir Yona
Added: Nov 8, 2015 12:29 PM
Views: 12
Tags: no tags
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4.  
  5. int main(int argc, char **argv)
  6. {
  7.    char hand[10][2];
  8.  
  9.    char inpLine[] = "1C 5H 4D 3C KD 2S 7H AD QC 2C";
  10.    int i;
  11.    char *s;
  12.  
  13.    s = strtok(inpLine, " ");
  14.  
  15.    i = 0;
  16.    while (s != NULL)
  17.    {  
  18.       memcpy(hand[i], s, 2);
  19.       printf("Hand %d - %c%c\n", i, hand[i][0], hand[i][1]);
  20.       s = strtok(NULL, " ");
  21.    }
  22.    printf("That's it ...\n");
  23.  
  24. }
  25.