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...
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

: for() {...}

144
145
146
147
val = 21

: for() {...}

144
145
146
147
val = 1234567.75

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

144
145
146
147
val = -nan

: for() {...}

144
145
146
147
val = -nan

604
605
606
607
argv[0] = 3093
608
609
610
611
612
613
614
615
argv[1] = 3100
argv[2] = 3106
616
617
618
619
620
621
622
623
argv[3] = 3109
argv[4] = 3119
3088
3089
3090
3091
3092
3093
3094
3095
?
?
?
?
?
'.' '/' 'm'
3096
3097
3098
3099
3100
3101
3102
3103
'a' 'i' 'n' '\0' 'h' 'e' 'l' 'l'
3104
3105
3106
3107
3108
3109
3110
3111
'o' '\0' '2' '1' '\0' '1' '2' '3'
3112
3113
3114
3115
3116
3117
3118
3119
'4' '5' '6' '7' '.' '7' '\0' 'w'
3120
3121
3122
3123
3124
'o' 'r' 'l' 'd' '\0'

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

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