Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start main()

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...
typedef struct thing { double something; // More members here... }Thing; // Allocate a new Thing and read the values from stdin
Thing* newThing(){
  ...
» Thing *p=NULL; » p=xmalloc(sizeof *p); » printf("Please enter the value of something\n"); » scanf("%lg", &p->something); // etc. » return p;
} int main(){
  ...
» Thing *t=NULL; » t=newThing(); » printf("%g\n", t->something); » return 0;
}
Memory

Allocated memory

128
129
130
131
132
133
134
135
128.something = 5.43521306e-311

newThing()

264
265
266
267
p = NULL

main()

296
297
298
299
t = NULL

NB: the actual memory address of each variable is the
address shown plus 4294641008 (0xFFFB0570).

The actual address of allocated memory is the
address shown plus 154763864 (0x9398258).

Show Advanced options

.

Input was:

3.8

Show output (Before looking at the output, work out what you think it put should be and see if you are right.)

Output

Please enter the value of something
3.8
                                                                                                                                                                                                                                                                       

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