将一串字符串中的字母和数字储存到对应数据类型的数组中,并输出

将一串字符串中的字母和数字储存到对应数据类型的数组中,并输出,输出用函数调用形式 。


#include <stdio.h>
#include <string.h>
void fun(char a[], char b[])
{
    int i;
    for(i = 0;i < strlen(a);i++){
        printf("%c",a[i]);
    }
    printf("\n");
    for(i = 0;i < strlen(a);i++){
        printf("%c",b[i]);
    }
}
int main()
{
    char word[256], a[256], num[256];
    int i, m = 0, n = 0;
    gets(a);
    for (i = 0; i < strlen(a); i++)
    {
        if (a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z')
        {
            word[m++] = a[i];
        }
        else if (a[i] >= '0' && a[i] <= '9')
        {
            num[n++] = a[i];
        }
    }
    fun(word, num);
    return 0;
}