今日私は新しいことをしようとしましたが、私は正しいことをしませんでした。誰もそれを行うことができ、それはなぜそんなにそんなに説明できますか?事前にありがとうmainの次の関数と配列の結果はどうなりますか?
iがn = 5未満つの番号に、1からカウントが行くことを取り払わので、私は、 1,2,3,4の結果を得た私の場合#include<stdio.h>
void function(int a[],int n)/*The definition of function with void type,with parameters
int a[],int n */
{
int i;// declared count,type integer//
for(i=0;i<n;i++)//count goes from 0,to <n,and increment all time while goes//
printf("%d",a[i++]);// printing on the screen integers (a[i],i=i+1)//
printf("\n");// printing the newline //
}
main()
{
int a[]={1,2,3,4,5,6,7}; // declaration of array with 7 elements //
int n=5;// declaration of variable n type integer value of 5 //
function(a,n) // calling the function with parametres a,n//
} // end of sequence //
、しかし、IDEはの結果を示し、
あなたがループ内で二度 'i'をインクリメントしている: ここでの作業、より読みやすいバージョンです。 –
あなたは私が2回増分しています –
@ Jean-FrançoisFabreは私からとても馬鹿です、私はそれを逃しました、uselles質問は今私が参照してください、ありがとう – Mark0n1