卡在C中的指针交换循环中

我现在尝试学习c,并且有一个示例不允许我使用string.h等函数。例如,我需要带有指针的反向字符串。但是当我交换时,它卡住了。

#include <stdio.h>
void reverseCopy( char * , char * ,int);
int main(){
    char *word1 = "Welcome to the C programming";
    char word2[50];
    int i,count;
    for(i=0;i<50;i++){
        if(word1[i]=='\0') break;
        count++;
    }
    reverseCopy(word1,word2,count);

return 0;
}
void reverseCopy( char * g1, char * g2 ,int lenght){
    g2=g1;
    char temp;
    int i;
    int j=temp-1;
    for(i=0;i<j/2;i++){
        temp=*(g2+i);
        *(g2+i)=*(g2+j-i);
        *(g2+j-i)=temp;
    }
    puts(g2);
}