fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. template <std::size_t sizeA, std::size_t sizeB>
  6. void clearArray(float (&a)[sizeA][sizeB])
  7. {
  8. float* begin = &a[0][0];
  9. fill_n(begin, sizeA * sizeB, 0);
  10. }
  11.  
  12. int main()
  13. {
  14. float f[5][6];
  15. clearArray(f);
  16.  
  17. for (int i = 0; i < 5; ++i)
  18. for (int j = 0; j < 6; ++j)
  19. cout << f[i][j] << " ";
  20. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0