非常にプログラミングには新しく、チュートリアルとしてプログラムコードでエラーを見つけるよう求められました。それを修正しようとしている間、私は個々の要素を渡してラベル付けされた行に対して、型int型の引数を型int型のパラメータと互換性がないようにし続けました。ポインタについて知りませんでしたし、関数がどのように機能するかを実際には理解していないので、他の場所でエラーが発生する可能性があります。"int"型の引数が "int"型のパラメータと互換性がありません
#include <iostream>
using namespace std;
void functionA (int num[]) ;
void functionB (int newnumbers[]) ;
void functionC (int newnumbers[]) ;
void main()
{
int numbers[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } ;
int i;
for (i=0; i<10; i++)
functionA (numbers[i]) ; // passing individual elements
cout << "\n\n" ;
functionB (numbers) ; // passing the whole array
functionC (numbers) ; // passing the whole array
cout << "\n\n" ;
}
void functionA (int num[])
{
cout << num << " " ;
}
void functionB (int newnumbers[])
{
for (int i=0; i<10; i++)
newnumbers[i] = newnumbers[i] * 5 ;
}
void functionC (int newnumbers[])
{
for (int i=0; i<10; i++)
cout << newnumbers[i] << " " ;
}
ああ、ありがとう! – Teh