File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -1103,23 +1103,22 @@ $(H3 $(LNAME2 cast_static_array, Static Arrays))
1103
1103
The cast is done as a type paint (aka a reinterpret cast).
1104
1104
The contents of the array are not changed.)
1105
1105
1106
- ---
1107
- import core.stdc.stdio;
1108
-
1109
- void main()
1110
- {
1111
- byte[16] b = 3;
1106
+ $(SPEC_RUNNABLE_EXAMPLE_RUN
1107
+ ---
1108
+ byte[16] b = 3; // set each element to 3
1109
+ assert(b[0] == 0x03);
1112
1110
int[4] ia = cast(int[4]) b;
1111
+ // print elements as hex
1113
1112
foreach (i; ia)
1114
- printf ("%x\n ", i);
1113
+ writefln ("%x", i);
1115
1114
/* prints:
1116
1115
3030303
1117
1116
3030303
1118
1117
3030303
1119
1118
3030303
1120
1119
*/
1121
- }
1122
- ---
1120
+ ---
1121
+ )
1123
1122
1124
1123
$(H3 $(LNAME2 cast_floating, Floating Point))
1125
1124
You can’t perform that action at this time.
0 commit comments