Please refer to the code below.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
const char* n[5] = { "str","aa","bb","cc","dd" };
FILE* fp = NULL;
fp = fopen("Word.txt", "w");
for (int i = 0; i < 5; i++)
{
fputs(n[i], fp);
fputc('\n', fp);
}
fclose(fp);
return 0;
}
The result
© 2025 OneMinuteCode. All rights reserved.