Hi,
I need to know what's the best way to save a matrix counters... I mean, by default I have a matrix defined with 25 lines and 80 columns, that's the max the matrix can have, however, my app asks the user to input his own values for lines and columns (which can't be more than 25 and 80 for each one of them)
I was trying to do the following:
Code:
void function2(char (*m)[80]) {
int lines, columns;
// here I'll read the values for lines and columns with scanf
// (A) read below...
m[1][0] = lines;
m[0][1] = columns;
}
void function1(void) {
char matrix[25][80];
function2(matrix);
}
(A) That's what I was trying to do, but than I realized I was setting an int value to a char array, which would have unwanted results as you know...
I was trying this same approach as you do with a simple array... array[50] where 50 is the max but at one point the array will only use 10 values, so you could save the value 10 at array[0] instead of using another unnecessary variable... and all operations with that array would go from array[1] to array[10]... I know i'm not explaining this in a good way but it's hard for me to type all this programming stuff in english... but I hope you understand.
So, what's the best way to save the counters for the matrix values? I know a simples solution would be to save them in 2 variables and pass them as arguments thorugh all the functions I need, but I was hoping to do that in a simple way, if possible...