How to properly terminate strings in C programming? : <p>I'm using scanf to scan 5 product names and store them in a string. However, when i print them, the last one is always printed as ♣. Where am i going wrong ?</p>

<p>I am trying to take in the id, name and prices of 5 products and print them using structures. However the last product name is always printed as ♣. I realised that this may be due to improper terminating of the string, and tried the solutions provided to such questions.
I saw another similar question on strings and tried to terminate the string properly by doing, char name[50]={'0'};    in my code. This part is within the structure part of the code.</p>

<pre><code>struct product
 {
    int id;
    char name[50];
    int price;
 };

void main()
 {
    struct product p [5];
    int i,a;
    for(i=1;i&lt;=5;i++)
    {
        printf("Enter the id no., name and price of the product %d\n",i);
        scanf("%d%s%d",&amp;p[i].id,&amp;p[i].name,&amp;p[i].price);
    }
    printf("The id no., name and price of the product %d are\n",i);
    for(i=1;i&lt;=5;i++)
    {
        printf("\t%d\t%s/0\t%d\n",p[i].id,p[i].name,p[i].price);
    }
}
</code></pre>

<p>The final output, that is p[5].name ,should've been what i had entered, but is, however, ♣.
And if i try to terminate the code by entering: char name[50]={'\0'};
it puts up an error message over the '=' saying that it expected a ';'.</p>
