我是比較新的C語言編程,我想編寫一個程序,在用戶的標記讀取並分配一個檔次輸入的標誌。 我已經使用getline()函數獲取用戶輸入。以下是我的代碼。 # include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
int getMark();
void display(char grad
我的代碼創建了一個由3個字符串組成的數組,並嘗試使用getline()填充每個字符串。它還打印每次得到的字符串: int i;
size_t n = 100;
char (*words[3])[100];
for (i = 0; i < 3; i++)
{
getline(&words[i], &n, stdin);
printf("%s\n",words[i]);