Advertisement
Guest User

Untitled

a guest
Sep 18th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. typedef struct node_ {
  7.     char* val;
  8.     struct node_ * next;
  9. } node;
  10.  
  11. int main(int argc, char** argv) {
  12.    
  13.     if (argc != 2) {
  14.         printf("ERROR: This program takes exactly one argument.\n");
  15.         return 1;
  16.     }
  17.    
  18.     char buffer[50] = "\0";
  19.        
  20.     int i;
  21.     for (i = 0; i < strlen(argv[1]) - 1; i++) {
  22.         char c = argv[1][i];
  23.         if (isalpha(c)) {
  24.             buffer[strlen(buffer)] = c; // Add character to buffer
  25.         } else {
  26.             printf("%s\n", buffer); // Print buffer
  27.             buffer = "\0"; // Clear buffer
  28.         }
  29.     }
  30.    
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement