My function gets a char array as input. If it includes character e it changes it with a and returns the new char array. Here is my code:
char echanger(char word[]){
int total = 0;
int i;
char final[5];
for(i=0;i<5;i++){
if(word[i]=='e'){
final[i] == 'a';
}
else{
final[i] == word[i];
}
}
return final;
}
I call it in in main() function like this:
int main(){
char a[] = "helle";
printf("new string is: %d \n",echanger(a));
}
it gives me this output:
new string is: -48
what I'm missing in here?
charbut you're returning achararray.