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...
// // Simple malloc demonstration // struct proj { float mass; float pos[2]; float v[2]; };
int main(){
  ...
» struct proj *p; » p=malloc(sizeof *p); » p->mass=11.7; » scanf("%g %g", &p->v[0], &p->v[1]); » return 0;
}
Memory

Allocated memory

128
129
130
131
132
133
134
135
128.mass = 1.85418203e+11
128.pos[0] = -7.98762e-06
136
137
138
139
140
141
142
143
128.pos[1] = -5.04837e+21
128.v[0] = 3.54852e-31
144
145
146
147
128.v[1] = 1.08878e-38

main()

280
281
282
283
p = -4287116527

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

The actual address of allocated memory is the
address shown plus 160801368 (0x995A258).

Show Advanced options

.

Input was:

4.7 8.1

                                                                                                                                                                                                                                                                       

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