Here is some code I have been working on but I can get the results im looking for. I cant manipulate the strings right. I have put comments as best I can so you can follow what im trying to do. Please help me fix this.
Code:
void Compress(char *str, Header *dict, int numb) {
   int j;
   char buffer[strlen(str)];  //I made a buffer to set the length
   char* w = buffer;  //Initialized W
   char k; //Made a character k
   char tmpw[strlen(str)]; //Made a temporary W
   strcpy(w, ""); //Here I want to set W to blank, im not sure if this is the right way so it might need fixed
   int i = 0; //Set i to 0
   while (i < strlen(str)) //Continue while i < the length of the incoming string
   {
     k = str[i]; // Here I want k to equal the ith character in the incoming string, i think this will work
     for(j = 0; j < strlen(w); j++)  //This loop is here to copy the contents of W to tmpw
     {                                          //There has to be a better way but everytime I tried  
       tmpw[j] = w[j];                  //somthing else when I changed W later it also 
     }                                          //changed tempw. I didnt know how to fix this
     strcat(w, &k); //Here I was to put the character k onto the end of the w string. I dont think this works but I dont know how to do it. This line needs fixed
     if(dict[hash(w)].next != 0) {
       //If WK is in the dictionary W = WK
       //I didnt do anything in here because I already put W and K together into W
     } else {
       //Otherwise it adds WK to the dictionary and outputs the code to W
       HashVal* newNode;
       newNode = (HashVal*) malloc (sizeof(HashVal));
       newNode->val = w;
       newNode->num = numb;
       newNode->next = NULL;
       numb++;
       dict[hash(w)].next = newNode;
       newNode = dict[hash(tmpw)].next; //Here is where I use temp W which should be the value of W
       strcpy(w, &k); //This also needs to set W to equal K. I dont think this is the right way but I dont know how to do it.  This needs fixed
     }
     i++;
   }
}