如何使用C语言从26个字母中随机选择单词?

har*_*ram 2 c

我希望代码从26个字母中随机选择单词(有意义或无意义).这个词包含6个字母.我有C程序或目标C的代码,或者你会给我任何想法.

Mat*_*ner 5

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

main()
{
    srand(time(NULL));
    for (int i = 0; i < 6; ++i)
    {
        putchar('a' + (rand() % 26));
    }
    putchar('\n');
    return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)

盐味.

Update0

看来OP似乎不知道如何编译上面的内容.如果保存到调用的文件中so.c,请使用make so CFLAGS=-std=c99同一文件夹进行编译.