hey guys, could someone help me with the output of this program:
i can't compile it, i get an error:Code:#include <stdio.h> #define newline {putchar(’\n’);} int main() { int *ptr,ii,jj; int arrayInts[] = {4,6,8,9,10,12,14,15,16,18}; ptr = arrayInts; printf("Hello."); printf("\nplease write me the output of this program\n"); printf("1) %d", ptr); newline; printf("2) %d", *ptr); newline; printf("3) %d",*ptr++); newline; printf("4) %d. ",&arrayInts[1]); ii=++ptr; jj=ptr++; newline; printf("5) %d.",ii-jj); newline; printf("6) %d.", *ptr); newline; printf("7) %d.",*(ptr+2)); newline; printf("8) %d.", *(arrayInts+2)); newline; ptr-=1; printf("9) %d.", *(ptr+=4)); newline; printf("10) %d",ptr[2]-arrayInts[2]); newline; printf("That’s it. \nGood luck\n\n"); return 0; }
"14[Warning] assignment makes integer from pointer without a cast "
and another Q if you will:
if i change :
to:Code:printf("10) %d",ptr[2]-arrayInts[2]); newline;
what will I get...?Code:printf("10) %d",ptr[2]-arrayInts[13]); newline;
can a pointer change the memory location of a whole array ?
thanx a lot !



LinkBack URL
About LinkBacks



. now u dont get any warning