#include <stdio.h>
#define N 40
void sum(int*p, int n, int d[])
{
int i;
*p = 0;
for(i = 0; i < n; ++i)
*p = *p + d[i];
}
int main()
{
int i;
int accum = 0;
int data[N];
for(i = 0; i < N; ++i)
data[i] = i;
sum(&accum, N, data);
printf("sum is %d\n", accum);
return 0;
}
vdhyasri 0 Newbie Poster
NathanOliver 429 Veteran Poster Featured Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.