Skip to content

Instantly share code, notes, and snippets.

@muaddib1971
Created January 15, 2017 19:55
Show Gist options
  • Select an option

  • Save muaddib1971/87a86200ea6903c4d7117693b7e8162f to your computer and use it in GitHub Desktop.

Select an option

Save muaddib1971/87a86200ea6903c4d7117693b7e8162f to your computer and use it in GitHub Desktop.
example of passing an array to a function in c
#include <stdio.h>
#include <stdlib.h>
int doit(int array[])
{
int i;
int sum=0;
for(i = 0; i < 10 ; ++i)
{
sum += array[i];
}
return sum;
}
int main(void)
{
int array[10] = {1,2,3,4,5,6,7,8,9,0};
printf("%d\n", doit(array));
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment