Zelený je lopuch, fotbal to je hra...Lopuch.cz
for (int i = 0; i < countof(arr); i++) { int x = arr[i]; ... }
#include <stdio.h> template<int n> void foo(int (&arr)[n]) { int sz = sizeof(arr); printf("size: %d\n",sz); } int main(int c, char **v) { int a[40]; foo(a); }
ondra@linda:/tmp$ g++ test.cpp -o test ondra@linda:/tmp$ ./test size: 160 ondra@linda:/tmp$
template<int n> void fce(int pole[n]) { int a; a = sizeof(pole); }
void add (A **array) { A* newA = malloc(sizeof(A)); newA->structB.value = 12345; array[1] = newA; }