title: C Pass Dynamic Array to Function
body: <pre><code>void word(FILE*fptr, char sender[]);
  
  void dosya(){
      FILE *fp1;
      fp1 = fopen("com.txt","r");
  
      int c, i, sendno=0, receiveno=0;
      char d, e, send, space1, space2, receive;
  
      char* sender = malloc(sizeof(char));
      while(send != ' '){                     /*read sender's name*/
          send = getc(fp1);
          if(send == ' ')
              break;
          else{
              sender[sendno] = send;
              sendno++;
              sender = (char *) realloc(sender, (sendno+1)*sizeof(char));
          }
       }
       e = getc(fp1);    /* read # character  */
  
       word(fp1, sender);
       fclose(fp1);
  
  }
  
  void word(FILE*fptr, char sender[]){
       printf("%s", sender);
  }
  
  // Driver program to test above functions./
  int main()
  {
       dosya();
       return 0;
  }
  </code></pre>
  
  <p>I create a dynamic array called sender with malloc and realloc it every time i read a letter, it stops when letter is space character. I want to use this array in another function. How can i reach it in word function?</p>