C returning answer through parameters ( refernce)
问题 Hy everyone, pls consider this small code, and help me to figure out, why it's not working? #include <stdio.h> #include <stdlib.h> void setup(int* helo) { helo = (int*) malloc(sizeof(int)); (*helo) = 8; } int main(int argc, char* argv[]) { int* helo = NULL; setup(helo); printf("Value: %s \n", (*helo)); getchar(); return 0; } 回答1: You are looking for one of two options here. You can either take the memory pointer allocation out of the equation, and pass the memory address of a standard