#include <stdio.h>
#include <stdlib.h>
int main()
{
int arr[4]={2,4,8,1},i=4,j;
printf ("arr[0]=%d\n",arr[0]);
printf ("arr[1]=%d\n",arr[1]);
printf ("arr[2]=%d\n",arr[2]);
printf ("arr[3]=%d\n",arr[3]);
printf ("arr[4]=%d\n",arr[4]); //garbage values
while(i)
{
j=arr[i]+i;
i--;
}
printf ("j=%d\n",j);
return 0;
}
#include <stdlib.h>
int main()
{
int arr[4]={2,4,8,1},i=4,j;
printf ("arr[0]=%d\n",arr[0]);
printf ("arr[1]=%d\n",arr[1]);
printf ("arr[2]=%d\n",arr[2]);
printf ("arr[3]=%d\n",arr[3]);
printf ("arr[4]=%d\n",arr[4]); //garbage values
while(i)
{
j=arr[i]+i;
i--;
}
printf ("j=%d\n",j);
return 0;
}
No comments:
Post a Comment