I know how to simulate passing by reference by using pointers. How does one do this for something that already IS a pointer? For example a C-style string?
In this example, mystring is still null, and myint is now 0. I want mystring = "hello"Code:int main() { char *mystring; int myint = 4; make_my_string(mystring, &myint); } void make_my_string(char *some_string, int *some_int) { some_string="hello"; some_int = 0; }



LinkBack URL
About LinkBacks



