-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToFunction2.cpp
More file actions
42 lines (37 loc) · 998 Bytes
/
ToFunction2.cpp
File metadata and controls
42 lines (37 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* \file ToFunction2.cpp
* \brief
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
//-------------------------------------------------------------------------------------------------
#define xARRAY_SIZE(a) \
( sizeof(a) / sizeof((a)[0]) )
//-------------------------------------------------------------------------------------------------
void
foo(
const int *Array,
size_t x,
size_t y
)
{
for (size_t i = 0; i < x; ++ i) {
for (size_t j = 0; j < y; ++ j) {
int var = Array[i * y + j];
std::cout << var << ", ";
}
std::cout << std::endl;
}
}
//-------------------------------------------------------------------------------------------------
int main()
{
const int x[][4]
{
{1, 2, 3, 4 },
{11, 12, 13, 14},
{21, 22, 23, 24}
};
foo((const int *)x, xARRAY_SIZE(x), 4);
}
//-------------------------------------------------------------------------------------------------