Hi,
I having a some trouble to figure out some questions my instructor gave me to answer.
I'm not sure how to get this answer can someone explain why?
-I thought the answer was -1120-2
-but the answer is -112
Code:
int main()
{
int a[] = {-2,-1,0,1,2,2,1,0,-1,-2};
int *p;
for(p=a+1; p<a+10 && *p; p+=2)
printf("%d", *p);
return 0;
}
I think the answer is 4, but the compiler gives me an answer of 3. Is there a reason why?
Code:
int main()
{
int a[]={-6. -4, -2, 0, 2, 4, 6};
int *p = a+4;
while(*p++)
putchar('*');
return 0;
}