在Python中,我们正在使用 print( "\n" * 15).我想知道如何在没有的情况下在c编程中做到这一点printf("\n\n\n....\n");.它有什么功能吗?
C没有字符串重复运算符,但它确实有一个你可以使用的函数:
char newlines[16];
memset(newlines, '\n', 15); /* <-- this function */
newlines[15] = '\0';
fputs(newlines, stdout);
Run Code Online (Sandbox Code Playgroud)