Ask your own question, for FREE!
Mathematics 22 Online
OpenStudy (anonymous):

Write a C function that sums all the elements of a n-dimensional vector: int sum(int A[], int n) /* Returns the sum of all elements of A */ { /* TODO */ }

OpenStudy (anonymous):

again wrong section..

OpenStudy (anonymous):

nobody's in the CS section :(

OpenStudy (anonymous):

everyone asks questions about CS here, so no one goes to CS

OpenStudy (anonymous):

Anyway, here's my answer int i, sum; sum = 0; for (i =0; i < n; sum += A[i++]); return sum;

OpenStudy (anonymous):

\[\vec{A}(0,5,1)\] How's that vector represented? as A[0]=0, A[1]=5, A[2]=1? if yes then it should be correct

OpenStudy (anonymous):

i'm just unsure if A[i++] works as it is intended

OpenStudy (anonymous):

http://ideone.com/CgU5i It works

OpenStudy (anonymous):

so how do I make it accept 64-bit integers?

OpenStudy (anonymous):

signed integers

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!