learning-cc4e

Solution to https://cc4e.com/. If you copy these you're not right in the head.
git clone https://kaka.farm/~git/learning-cc4e
Log | Files | Refs

solution.c (500B)


      1 void process(line)
      2     char line[];
      3 {
      4   char *line_ptr, ninth_char;
      5   int char_count = 0;
      6 
      7   printf("\nString: ");
      8 
      9   for (line_ptr = line; *line_ptr != '\0'; ++line_ptr) {
     10     ++char_count;
     11     if (char_count == 10) {
     12       ninth_char = *line_ptr;
     13     }
     14     putchar(*line_ptr);
     15     if (*line_ptr == ' ') {
     16       *line_ptr = '-';
     17     }
     18   }
     19 
     20   printf("\nCount=%d\n", char_count);
     21 
     22   if (char_count > 10) {
     23     printf("The ninth character is: %c\n", ninth_char);
     24   }
     25 
     26   printf("String: %s\n", line);
     27 }