```
#include <stdio.h>
#include <stdlib.h>

int sum_elements_with_size(int a[], int size){
    int sum=0;
    for(int i=0; i< size ; i++){
        sum= sum + a[i];
    printf("i=%d \n sum= %d \n", i, sum);
    }
    return sum;
}

int main(){
    int a[5];
    a[0]= 1;
    a[1]= 2;
    a[2]= 0;
    a[3]= 1;
    a[4]= 3;
    sum_elements_with_size( a, 5);
    printf(" sum= %d \n", sum_elements_with_size( a, 5)); 
    system( "PAUSE");
    return 0;
}

```

I'm just beginning to self learn C. I'm trying to have my function return sum but when I try to `printf(" sum= %d \n", sum);` it does not work (says "sum is unidefined"). I try adding int sum into main but then it says "uninitialized local variable used". I end up having to use `printf(" sum= %d \n", sum_elements_with_size( a, 5))` above for it to work. Can anyone tell me why?