Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #define MAXLINE 1000
- /*#define YES 1
- #define NO 0 */
- char process_line(char line[]);
- main(void)
- {
- char line[MAXLINE] ;
- gets(line);
- process_line(line);
- /*puts(line);*/
- system("pause");
- return 0;
- }
- char process_line(char buffer[])
- {
- char c;
- char prev_c;
- char *ptr;
- int counter;
- ptr = buffer;
- prev_c =' ';
- c = *ptr;
- counter = 0;
- while (c != '\0')
- {
- if ((prev_c == 'c') && (c == 'd')) counter++;
- prev_c = *ptr;
- ptr++;
- c = *ptr;
- }
- printf("counter = %i\n", counter);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement