写一个程序,判断运行程序的系统的是大字节序还是小字节序

#include <stdio.h>
void checkSystem()
{
    union check
    {
        int i;
        char ch;
    }c;
    c.i = 1;
    if ((char)1 == c.ch)
        printf("系统是小字节序\n");
    else
        printf("系统是大字节序\n");
}

int main(int argc, char *argv[])
{
    checkSystem();
    return 0;
}
写函数实现大小字节序转换。(需要写)