Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start program

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...
int main(int argc,char *argv[]){ » if (argc>=0) printf("Welcome to \"%s\"\n", argv0); » for ( int i=1;i<argc; ++i) { » float val; » printf("Argument %d: \"%s\"\n", i, argvi); » if (sscanf(argvi, "%g", &val)>0) printf("\tthe value is %g\n", val); } » return 0; }
...
Memory

main()

132
133
134
135
argv = 604
184
185
186
187
argc = 5

main(): for()

140
141
142
143
i = 1

main(): for() {...}

144
145
146
147
val = 1234567.75

main(): for() {...}

144
145
146
147
val = -nan

main(): for() {...}

144
145
146
147
val = -nan

main(): for() {...}

144
145
146
147
val = 21

604
605
606
607
argv[0] = 8165
608
609
610
611
612
613
614
615
argv[1] = 8172
argv[2] = 8178
616
617
618
619
620
621
622
623
argv[3] = 8181
argv[4] = 8191
8160
8161
8162
8163
8164
8165
8166
8167
?
?
?
?
?
'0' ' ' 'C'
8168
8169
8170
8171
8172
8173
8174
8175
'S' '_' 'A' 'R' 'R' 'A' 'Y' '_'
8176
8177
8178
8179
8180
8181
8182
8183
'c' 'h' 'a' 'r' '[' '6' ']' ' '
8184
8185
8186
8187
8188
8189
8190
8191
' ' '4' '2' '9' '3' '0' '5' '3'
8192
8193
8194
8195
8196
8197
8198
8199
'6' '6' '8' ' ' ' ' '4' '2' '9'

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

Show Advanced options

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

Output

Welcome to "./main"
Argument 1: "hello"
Argument 2: "21"
	the value is 21
Argument 3: "1234567.7"
	the value is 1.23457e+06
Argument 4: "world"
                                                                                                                                                                                                                                                                       

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