This commit is contained in:
Debucquoy
2023-09-20 15:18:20 +02:00
parent 00d0cdfaf3
commit 4fd7542f03
228 changed files with 351 additions and 12 deletions

24
bac2/os/chap0/ex3.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdlib.h>
#include <stdio.h>
void replace(char string[], char target, char replacement);
int main(int argc, char *argv[])
{
char test[] = "test";
printf("%s\n", test);
replace(test, 'e', 'a');
printf("%s\n", test);
return 0;
}
void replace(char string[], char target, char replacement){
int i = 0;
while(string[i] != '\0'){
if(string[i] == target){
string[i] = replacement;
}
i++;
}
}