Structure C: Storing values in an array
<p>Can anyone advise why values are not getting stored in struct array? 
I tried to store values in buffer array and I notice values that are getting stored 0 or 1 not user input. </p>

<p>This is what I tried: </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;

int menu(void);
struct item
{
    int i_SKU;
    int i_QUANTITY;
    int i_PRICE;
};

int main()
{
    int i,j = 0;;
    int n;
    int input;
    //struct item item1[10] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0} };
    struct item item1[]={0};
    struct item buff[]={0};
    //printf("size of %d", sizeof(item1)/sizeof(item1[0]));
    printf("Welcome to the Inventory\n");
    printf("===================\n");
B: printf("Please select from the following:\n");

A: menu();
    scanf("%d", &amp;input);

    switch (input)
    {
        case 1:
            printf("Inventory\n");
            printf("=========================================\n");
            printf("ku     Price     Quant\n");
            for (i = 0; i &lt; sizeof(buff)/sizeof(buff[0]); i++)
            {
                printf("%d     %d        %d\n", buff[i].i_SKU, buff[i].i_PRICE, buff[i].i_QUANTITY);
            }
            printf("=========================================\n");
            goto B;

        case 2:
            //n = sizeof(item1)/sizeof(item1[0]) + 1;
            //for (i=n; i &lt; ; i++)
            printf("Please input a KU number:");
            buff[j].i_SKU=scanf("%d", &amp;item1[j].i_SKU);
            printf("Quantity:");
            buff[j].i_QUANTITY=scanf("%d", &amp;item1[j].i_QUANTITY);
            printf("Price:");
            buff[j].i_PRICE=scanf("%d", &amp;item1[j].i_PRICE);
            printf("The item added.\n");
            j=j+1;
            goto B;

        case 0:
            printf("bye!");
            exit(1);

        default:
            printf("Invalid input, try again:\n");
            goto A;
    }

    return 0;
}

int menu(void)
{
    printf("1) Display.\n");
    printf("2) Add to inventory.\n");
    printf("0) Leave.\n");
    printf("Select:");
    return 0;
}
</code></pre>

<p>I tried to store values in buffer array and I notice values that are getting stored 0 or 1 not user input. </p>