Skip to content

Instantly share code, notes, and snippets.

@easleyschool
Created October 11, 2019 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save easleyschool/3bce9402523d56e144ab491a40ac5e55 to your computer and use it in GitHub Desktop.
Save easleyschool/3bce9402523d56e144ab491a40ac5e55 to your computer and use it in GitHub Desktop.
/* n is the length of array a[] */
int sum(int a[], int n)
{
int x = 0; // 4 bytes for x
for( int i = 0; i < n; i++ ) // 4 bytes for i
{
x = x + a[i];
}
return(x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment