代码片段(1)[全屏查看所有代码]
1. [代码][C/C++]代码
01 | // adf.cpp : Defines the entry point for the console application. |
02 | // |
03 |
04 | #include "stdafx.h" |
05 | #include <iostream> |
06 |
07 | typedef unsigned short uint16; |
08 |
09 | struct video_struct{ |
10 | int frames, rows, cols, bits_per_component, mode; |
11 | uint16*** data[5]; |
12 | }; |
13 |
14 | int _tmain( int argc, _TCHAR* argv[]) |
15 | { |
16 |
17 | video_struct _v1; |
18 | for ( int i = 0; i < 5; i++) |
19 | { |
20 | _v1.data[i]= (uint16***) malloc ( sizeof (uint16)*3); |
21 | for ( int j = 0; j < 3; j++) |
22 | { |
23 | ((_v1.data[i]))[j]= (uint16**) malloc ( sizeof (uint16)*3); |
24 | for ( int x = 0; x < 3; x++) |
25 | { |
26 | ((_v1.data[i][j]))[x] = (uint16*) malloc ( sizeof (uint16)*3); |
27 | } |
28 | } |
29 | } |
30 | for ( int x1 = 0; x1 < 5; x1++) |
31 | { |
32 | for ( int x2 = 0; x2 < 3; x2++) |
33 | { |
34 | for ( int x3 = 0; x3 < 3; x3++) |
35 | { |
36 | (*(_v1.data[x1][x2]))[x3] = x1+x2+x3; |
37 | } |
38 | } |
39 | } |
40 | _v1.frames = 1; |
41 | _v1.rows = 1; |
42 | _v1.cols = 1; |
43 | _v1.bits_per_component = 1; |
44 | _v1.mode = 1; |
45 | uint16 cds = _v1.data[0][0][0][2]; |
46 | return 0; |
47 | } |