#include <stdio.h>
int main()
{
    int arr[3],i=0;
    while(i<3)
    {
        arr[i]= ++i;
    }
    for(int i=0;i<3;i++)
    {
        printf("%d\n",arr[i]);
    }
    return 0;
}
why is this outputting garbage value,1,2 ? i expected it to be 1,2,3. Please help
TIA
 
    