Difference between Pointers and Arrays

Jim Bittman jmbj at grebyn.com
Sat Mar 3 20:41:41 AEST 1990


Could someone please help me, I'm sure this is a fundamental question,
but I can't seem to figure it out.  I am calling a library routine that
expects an address, it works when I declare the array, but not when I
allocate memory to a pointer.  I'm using Turbo C 2.0 and the large
Memory Model.

double x[256];
double *xp;
int i;
main() {
xp = farcalloc(256,8);
for i = 
  *(xp + i) = expression;
for i = 
  x[i] = *(xp + i);   /* I did this to verify xp set correctly */
LibRoutine(xp,...)    /* doesn't work */
LibRoutine(x,...)     /* does work */
}
Thanks for any help, mail would probably be better than cluttering the
net.  Jim Bittman, jmbj at grebyn.com



More information about the Comp.lang.c mailing list