I can fill a value via two functions as below, but how can I fill more values (like an array)?
I need the most efficient way, thanks for helping.
void function1(char *pointer)
{
*pointer = 0x07;
}
void function2(void)
{
char value;
function1(&value);
}
int main(void)
{
function2();
return 1;
}
I did this but I need a more elegant way to do the same thing (I do not want to use an array as parameter):
void function1(char pointer[])
{
pointer[0] = 0x07;
pointer[1] = 0x08;
pointer[2] = 0x09;
}
void function2(void)
{
char value[3];
function1(&value[0]);
printf("value[0] = 0x%X\n", value[0]);
printf("value[1] = 0x%X\n", value[1]);
printf("value[2] = 0x%X\n", value[2]);
}
int main(void)
{
function2();
return 1;
}
Last edited on