title: String Processing in C -- Pointer and Call-by-Reference Issue
body: <p>So I got my code to successfully convert english to pig latin, but when I pass the variable back to main{}, I can only somehow return an address location or some hex or char number. I've tried to use different conversion specifiers and everything, but for some reason, I can't get it to output the string. This program reads from an input txt file, computes the translation, then prints to an output txt file. Let me know what you may think is the issue. Thanks! </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #define MAX_STR_SIZE 50
  
  char * convertToPigLatin (char * strPtr, char * pLatinStr);
  
  int main(int argc, char *argv[])
  {
     char str[MAX_STR_SIZE];
     char pStr[MAX_STR_SIZE];
     char *pStrPtr;
     FILE *fileInPtr;                                     //Create file name
     FILE *fileOutPtr;    
  
     fileInPtr = fopen("pigLatinIn.txt", "r");    //Assign text to file
     fileOutPtr = fopen("pigLatinOut.txt", "w");
  
     if(fileInPtr == NULL)                                //Check if file exists
     {
        printf("Failed");
        exit(-1); 
     }
     fprintf(fileOutPtr, "English Word\t\t\t\tPig Latin Word\n", pStr);
     fprintf(fileOutPtr, "---------------\t\t\t\t----------------\n", pStr);
  
     do                   //Cycles until end of text
     {
        fscanf(fileInPtr, "%29s", str);               //Assigns word to *char
  
        str[29] = '\0';                           //Optional: Whole line
  
        pStrPtr = convertToPigLatin(str, pStr); 
  
        fprintf(fileOutPtr, "%15s\t\t\t\t%15p\n", str, *pStr); 
  
     }  while(!feof(fileInPtr));   
  
     system("pause"); 
  }
  
  char * convertToPigLatin (const char * strPtr, char * pStrPtr)
  {
     int VowelDetect = 0; 
     int LoopCounter = 0; 
     int consonantCounter = 0; 
     char pStr[MAX_STR_SIZE] = {'\0'};
     char cStr[MAX_STR_SIZE] = {'\0'};
     char dStr[] = {'-','\0'}; 
     char ayStr[] = {'a','y','\0'};
     char wayStr[] = {'w','a','y','\0'};
  
     pStrPtr = pStr; 
  
     while (*strPtr != '\0')
     {
        if (*strPtr == 'a' || *strPtr == 'e' || *strPtr == 'i' || *strPtr == 'o' || *strPtr == 'u' || VowelDetect ==1)
        {
           strncat(pStr, strPtr, 1); 
           VowelDetect = 1; 
        }
        else
        {
           strncat(cStr, strPtr, 1); 
           consonantCounter++; 
        }
        *strPtr++;
     }
     strcat(pStr, dStr); 
     if (consonantCounter == 0)  
     {
        strcat(pStr, wayStr);
     }
     else
     {
        strcat(cStr,ayStr);
        strcat(pStr, cStr);
     }  
   //printf("%s\n", pStr);                         
  
     return pStr; 
  }
  </code></pre>