Tolik rozruchujen v LopuchuLopuch.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); }