I have limited experience with C and some experience with C++. I am developing code to be used on a microcontroller (which is why I am using the keyword "unsigned") and I want to make sure I am doing this correctly. I want to fill an unfilled array in main using a subroutine, is this the proper way of passing a variable in this situation?
Thank you for the help.
Jake
Code:
#include <stdio.h>
void fillZero(unsigned int *data[], unsigned int size); //Function Prototype
int main(void) {
unsigned int myData[2];
fillZero(myData[], 2);
// Additional code that uses the now filled array
return(0);
}
void fillZero(unsigned int *data[], unsigned int size) {
for (int i=0; i < size; i++) {
data[i] = 0;
}
}
Jake
Comment