Code:
#include "vncstudent.h"
#include "pprint.c"
char HOMEDIR[20]; 


int main()
{
  extern char HOMEDIR[]; 
  padd();  
  pprint();
  printf("here:%s\n", HOMEDIR);
  return 0;
}


void padd()
{ int c;
  char add1[20];
strcat(add1, system("pwd"));
  printf("a:%s\n", system("pwd"));
}

Code:
#include "vncstudent.h"


void pprint()
{


  extern char HOMEDIR[];
  printf("in pprint:%s\n", HOMEDIR);
}



I want to make the HOMEDIR to be able to contain the address after I run "pwd" in the shell. Therefore, I made the the c program to run a system() and paste the result to array, but it is not working. Therefore, I have 2 questions:
1. How can I make the HOMEDIR reveive the updated address and be able to use it in every different module?

2. strcat(system(add1, system("pwd")) seems giving me segmentation fault. how can I paste the result to an array?