online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #include <string.h> #define SIZE 20 void pluralize(char str1[]); void removal(char *p, char c); char str1[SIZE]; int main() { printf("This finds the pluralized version of chair, dairy, circus, fly, dog, church, clue, or dish :\n"); char str1[SIZE]; scanf("%s", str1); pluralize(str1); return 0; } void pluralize(char str1[]) { int i; char last_char = str1[strlen(str1)-1]; switch(str1[strlen(str1)-1]) { case 'y': removal(str1,'y'); strcat(str1,"ies"); printf("%s", str1); break; case 'h': strcat(str1,"es"); printf("%s", str1); break; case 's': strcat(str1,"es"); printf("%s", str1); break; case 'r': strcat(str1,"s"); printf("%s", str1); break; case 'g': strcat(str1,"s"); printf("%s", str1); break; case 'e': strcat(str1,"s"); printf("%s", str1); break; } } void removal(char *p, char c) { char *pdest = p; while (*pdest) { if (*pdest == c) *pdest = '\0'; *pdest++; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue