i've been tasked with writing a C program that recieves in input two strings (I can decide their content during the decleration) and returns a third string that is the concatenation of the two previous strings.
Moreover, I also need to replace each vowel of the third string with a star symbol '*'.
The main difficulty that i'm encountring is how to return a string from a function that takes in input two strings. A correction of my faulty code would also be much appreciated :)
Here is the code:
#include <stdio.h>
#include <string.h>
const char* concatvow (char *str1, char *str2);
int main()
{
    char word1[20]="One plus one ";
    char word2[20]="eqauls two";
    char *word3[20];
    
    concatvow(word1, word2);
    
    printf("%s", *word3);
    return 0;
}
const char* concatvow (char *str1, char *str2){
    char strfinal[20];
    int i=0;
    
    strcat(str1, str2);
    
    strcpy(strfinal, str1);
    
    if(strfinal[i]==65 || strfinal[i]==69 || strfinal[i]==73 || strfinal[i]==79 || strfinal[i]==85)            {
       strfinal[i]='*';
    }
return strfinal;
}
This is the output of my code.
main.c: In function ‘concatvow’:
main.c:33:8: warning: function returns address of local variable [-Wreturn-local-addr]
   33 | return strfinal;
      |        ^~~~~~~~
...Program finished with exit code 0
Press ENTER to exit console.
 
     
    