I want to return the result of a function through the pointer *address
, given as parameter. My code below prints this output:
Result:
But I was expecting:
Result: 123456
Why isn't it working as expected?
#include <stdio.h>
static void get_address(char *address) {
address = "123456";
}
int main(int argc, const char * argv[]) {
char address[34];
get_address(address);
printf("Result: %s\n",address);
return 0;
}