Liste des Groupes | Revenir à cl c |
David Brown <david.brown@hesbynett.no> writes:This works in C too. You don't need by-reference parameters, but you do need to switch sizeof to work directly on the type:
[...]In C++, you can't pass arrays as parameters at all - the language#include <cassert>
inherited C's handling of arrays. You can, of course, pass objects of
std::array<> type by value or by reference, just like any other class
types.
typedef int array42[42];
void func(array42& param) {
assert(sizeof param == 42 * sizeof(int));
}
int main() {
array42 arg = { };
func(arg);
}
Les messages affichés proviennent d'usenet.