Advertisement
markkoval1999

Untitled

Nov 2nd, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS
  3. #include <stdio.h>
  4. #include <string.h>
  5. int main(void)
  6. {
  7.     char* limits = " ,-!";
  8.     char str[20];
  9.     char save_str[10][10];
  10.     int len[10];
  11.     int i = 0;
  12.     printf("Full the string\n");
  13.     fgets(str,20,stdin);
  14.     char* str1 = strtok(str, limits);
  15.     while (str1 != NULL)
  16.     {
  17.         len[i] = strlen(str1);
  18.         strncpy(save_str[i], str1, 10);
  19.         save_str[i][9] = '\0';
  20.         printf("%d: %s\n", len[i], str1);
  21.         str1 = strtok(NULL, limits);
  22.         i++;
  23.     }
  24.     printf("new\n");
  25.     {
  26.     for (int j = 0; j < i; j++)
  27.    
  28.         printf("%s\n",save_str[j][len[j]]);
  29.     }
  30.     getchar();
  31.     getchar();
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement