Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Assignment 8 pt 2
#include <stdio.h> int main(void) { int n; int x=0; char test; char name[40]; char sub; printf("Please enter the character you are searching for\n"); scanf("%c", &test); printf("Please enter the character you wish to replace the searched character for\n"); scanf("%c", &sub); printf("Please enter the string you are searching for the character in\n"); scanf("%s", &name); n=sizeof(name); for(int i=0; i<n; i++){ if (name[i]==test){ name[i]=sub; printf("%c detected at index %d\n", test, i); x++; } } if(x==0){ printf("-1"); } if(x>0){ printf("%s",name); } }
run
|
edit
|
history
|
help
0
150116_FactorialPrimo
B_141125_MenorMayor
Official Hello world
FahrenheitToCelcius
Lab 9 v0.5
stack
18BCE2182 ASSESS_1 Q1-8
120465-11.1-3E
PUNTEROS 1
PRACTICA LISTA