/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#include <string.h>
int sum(int a[], int n) {
int sum = 0;
for(int i=0; i<n; i++)
sum += a[i];
return sum;
}
int main()
{
int a[] = {1,2,3,4};
char *s = "1234";
printf("%d", sum(a, sizeof(a)/sizeof(a[0])));
printf("%d", sum(s, sizeof(s)/sizeof(s[0])));
return 0;
}