Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Programming realization: Use a pointer to assign an integer array of 10 elements through keyboard input, and then output these 10 elements and sum them.
Programming realization: Use a pointer to assign an integer array of 10 elements through keyboard input, and then output these 10 elements and sum them.
# include & ltstdio.h & gt

int main()

{

int a[ 10],sum,* p;

for(p=a,sum = 0; p & lta+ 10; ++p)

{

scanf("%d ",p);

sum+= * p;

}

for(p = a; p & lta+ 10; ++p)

{

printf("%d ",* p);

}

printf("\n%d\n ",sum);

Returns 0;

}