0
我必須寫,檢查如果一個值位於與使用用於loop.I N個元素的數組寫的代碼的函數C程序陣列和用於循環鍛鍊
#include <stdio.h>
int main()
int N[100],n,i;
printf ("Write the value of n:");
scanf ("%d",&n);
i=0;
printf ("Write the value of the element :");
scanf ("%d",&v[i]);
for (i=0,i<n,i++)
{
if (N[i]==n)
}
printf ("The value is located in the array :");
return 0;
當我編譯它,它說printf之前的語法錯誤。這是什麼意思?我做錯了什麼?
您需要用括號'{printf();}'將'printf'括起來。您還必須關閉'for'循環的括號。 「main」的括號在哪裏? – AntonH
圍繞'printf'放置括號不會解決這個問題。首先,你的整個'main'函數需要括號;語法就像'int main(){... code goes here ...}'。 – larsks
您需要花一些時間閱讀關於C語法的基本書籍。 – larsks