c语言写一个函数,使字符串求逆序数输出

问题遇到的现象和发生背景

我想编写一个函数能使字符串逆序数输出,但是我的不知道为什么一直没有输出,哪位大佬能帮帮忙?万分感谢!

#include <stdio.h>

void stringNx(char a[]) //函数名
{
int i = 0;
int n = 0;
for (i = 0; a[i] != '\0'; i++)
{
n++;
}
int t = 0;
int j = n - 1;
for (t = 0; t < j; j--,t++)
{
int temp = 0;
a[j] = temp;
temp = a[t];
a[t] = a[j];
}

}
int main()
{
int i = 0;
char a[10] = {0};

gets(a);
stringNx(a);
printf(" %s", a);
return 0;

}

我想要达到的结果:错误究竟在哪里?

换数据逻辑有问题,temp 先存一个变量,然后再交换,如下:

int temp = 0;
temp = a[j];
a[j] = a[t];
a[t] = temp;