in the function different i want to search for a specific letter which i set in a printf an scanf request in my main function. In the main function i also set the text and the letter which should be insert for the other letter.
#include <stdio.h>
#include <string.h>
int change (char *text, char search, char replace)
{
int i=0;
char help[40];
sprintf(hilf,"%s",text);
for(i=0; i<= strlen(help); i++)
{
if(help[i]==search)
{
help[i]==replace;
}
}
}
int main()
{
char name[40];
int z, ne;
printf("\nName: ");
fgets(name, sizeof(name),stdin);
printf("\nwhich sign do you want to replace: ");
scanf("%i", &z);
printf("\nnew sign: ");
scanf("%i", &ne);
change(name, z, ne);
printf("\nchanged text is: %s", name);
}
Aucun commentaire:
Enregistrer un commentaire