Hi guys, could you please help me with this code:
I need to compare argv with char text[], if argv[1] (for example: if I set ./program a via command line) i need to replace all 'a' in text with 'e'.
I tried somethin like this:
But because I'm total beginner in programming could you please help more. What loop I have to use to move char by char to change the letter of the string with this strchr function?
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int i = 0;
char text[] = "stamp palm lamb america latino karate";
int l = strlen(text);
char buf[100];
char *pos = strchr(text, 'a');
if (pos)
printf("Character 'e' found at position %d.\n", pos - text);
return(0);
}