So I want to create some functions that take arrays as input, but I don't know how many dimensions the array will have.
Is there a way in c to determine how many dimensions an array has? (ideally as a function)
So I want to create some functions that take arrays as input, but I don't know how many dimensions the array will have.
Is there a way in c to determine how many dimensions an array has? (ideally as a function)
So this is actually a fairly difficult problem in C. Usually this is solved using one of three ways:
'\0'
for stringsstruct
togetherIf I remember correctly, there's a way to figure out the size of an allocated array using *nix systems, but I definitely would not recommend doing this. Just keep track of your allocated memory.