|
|
|
|
|
by dfawcus
193 days ago
|
|
depending upon how one has structured the code, a less painful way to write the same is: typedef char array[5];
void do_something(array *a) {
enum { a_Size = sizeof *a };
memset(*a, 'x', a_Size);
}
it rather depends upon how painful it will be to create a bunch of typedefs.Beyond a certain point, if there are too many arrays of the same size with different purposes, my inclination is to wrap the array in a struct, and pass that around (either by pointer or value depending upon circumstances.) The existence of the decaying form is if I recall correctly a backward compatibility thing from either B or NB; simply because in one or the other pointers were written in the (current) array syntax form. |
|