Sorry for the trouble. I've the following array list that is initialized as size 1. However i can do a scanf and loop through list[0] to list[4] without having any problem in visual studio 2010.
Isn't there supposed to have an error here?
void main()
{
int i=0,menu_choice=0;
int size;
int list[1]; //array initialized with size 1
do{
printMenu();
printf("Enter Your Choice: ");
scanf("%d",&menu_choice);
switch(menu_choice){
case 1:
printf("\n");
printf("Enter array size: ");
scanf("%d",&size);
printf("Enter %d numbers: ",size);
for(i=0;i<size;i++)
{
scanf("%d",&list[i]);
}
for(i=0;i<size;i++)
{
printf("%d",list[i]);
}
break;
default :
printf("Please select the right choice \n");
break;
}
}
while(menu_choice!=8);
}
int list[1];to be the first line inmainand see how things change.