mlwiese@athena.mit.edu (Michael L Wiese) (06/29/89)
I'm posting this for a friend; send replies to me though. The following C program runs fine on an SE, but refuses to execute the last line (the printf) on my SE/30. I have tried it with a bare System 6.0.3 to no avail. I'm using 3.01 upgraded to 3.02 with the patch available from sumex-aim.stanford.edu. I'm new to C and LSC; any help would be appreciated. #include <stdio.h> #include <storage.h> typedef float TRANSFORM[4][4]; TRANSFORM *IDENT, *another; int alloc(amount) int amount; { char *temp; char *memptr; memptr = (char *) malloc(amount); printf("lvalue memptr = %u\n",&memptr); printf("rvalue memptr = %u\n",memptr); printf("rvalue *memptr = %d\n",*memptr); if(memptr == NULL) printf("Error: malloc fails\n"); else { temp = memptr; while(amount--) *temp++ = 0; } return((int)memptr); } main() { IDENT = (TRANSFORM *) alloc(sizeof (TRANSFORM)); another = (TRANSFORM *) alloc(sizeof (TRANSFORM)); (*IDENT)[2][2] = 3.1415; (*another)[2][2] = 1.234; printf("IDENT: %g another: %g\n",(*IDENT)[2][2],(*another)[2][2]); } Mike Wiese mlwiese@eagle.mit.edu