Created
February 22, 2016 03:40
-
-
Save lamenezes/88bd0818b9886b2faeee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void remove_caracter(char *palavra, char caracter) { | |
int i, encontrou_caracter = 0; | |
for(i = 0;i < 10; ++i) { | |
if(palavra[i] == caracter && encontrou_caracter == 0) { | |
encontrou_caracter = 1; | |
} | |
else if(encontrou_caracter == 1) { | |
palavra[i - 1] = palavra[i]; | |
} | |
} | |
} | |
int main(int argc, char *argv[]) { | |
char palavra[10], caracter; | |
printf("Digite o caracter: "); | |
scanf("%c", &caracter); | |
printf("Digite a palavra: "); | |
scanf("%s", palavra); | |
remove_caracter(palavra, caracter); | |
printf("\n\npalavra capada: %s\n\n", palavra); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment