First of all, I understand this may be newbie, but I'm just starting. Please, try to be patient.
I want to make a function that should sum all numbers before find number '0'.
E.g.
"1230" should return "6".
But I'm not understanding how can I scan an integer array. 
This is my code, and compiler says "Segment fault (core dumped). 
What is wrong?

```
#include <stdio.h>

int main(){
    int sum, i, x[1000];
    printf("Insert a number");
    scanf("%d", &x[i]);
    sum=0;

    for (i=0; x[i]!='0'; i++)
       sum=sum+x[i];

    printf("%d", sum);
    return 0;
}

```