Is this portable?

Evan Bigall evan at plx.UUCP
Wed May 10 02:39:31 AEST 1989


This works on my machine, but I am curious as to whether it is "officially"
correct and portable C.  I can think of some machines where it could be trouble

	main()
	  { int array[10], *ptr, j;

	    for(j=0; j<10; j++)
	      array[j]=j;

	    ptr= &array[1];

	    for(j= -1; j<9; j++)
		printf("%d\n", ptr[j]);
	  }

This is a contrived example, in context it makes a lot more sense.

Evan



More information about the Comp.lang.c mailing list