Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Next step ›

Try stepping through the code


  Value and type of last evaluated expression: Address of array element: Address of array elementx:  (none)

Your browser does not support the canvas element which will make some the features unavailable.

If you are using Internet Explorer within the University of Exeter try going to the Settings menu (probably the gear shape at the top right of this page), selecting "Compatibility View settings", unchecking "Display intranet sites in Compatibility View" and reloading this page.

Code

 Header...
// // Read up to maxv integers, return the number read // or -1 if the file could not be opened
int better_readarray(int input[],int maxv){ » int i; » FILE *infile; » if ((infile=fopen("mydata.dat", "r"))==NULL) { » fprintf(stderr, "Failed to open mydata.dat for input\n"); » return -1; } » printf("In readarray() the array is stored at address %p\n", input); » for (i=0; i<maxv; ++i) { » if (fscanf(infile, "%d\n", &input[i])!=1) break; } » return i; }
...

Show Advanced options

.
                                                                                                                                                                                                                                                                       

Validate   Link-check © Copyright & disclaimer Share
Back to top