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
FUNTION3
My first program
Spring 2017 Lab 5 v1
Largest and smallest
Assignment 3
Project 3 Part 1 v0.5
24-June-2015
1.2 No. of Threads
print_odd_pointer.c
CstructProduct