How to calculate sum of an integer array?

int test[5]={544,4444,344,652,441};
int i,sum=0,*ptr=test;
for(int i=4;i>=0;i--)
sum=sum+*ptr++;

Leave a Reply