Home > Back-end >  An array of
An array of

Time:09-21


Define an array, the array input 6 elements, and print the show just six data input,

CodePudding user response:

 
#include

Int main ()
{
Int a [6]={0};
int i;
for(i=0; I & lt; 6; I++)
The scanf (" % d ", & amp; A [I]);
for(i=0; I & lt; 6; I++)
Printf (" % d ", a [I]);
return 0;
}


That is what you mean?

CodePudding user response:

Upstairs is

We are, is another kind of answer:

#include

Int main ()
{
Int a [6]={0};
int i;
for(i=0; I & lt; 6; I++)
The scanf (" % d ", a + I);//a is an integer pointer, add 1, 4 bytes represent backward, to the next integer array element
for(i=0; I & lt; 6; I++)
Printf (" % d ", a [I]);
return 0;
}
  • Related