Home > Back-end >  Why the printf output nothing
Why the printf output nothing

Time:10-05

I give initialized to 0 to null string he is output
Don't initialize the code
Answer why o

CodePudding user response:

Mian function has been defined in a structure, system has opened up a memory, you call the initialization function, you are using references, so processing function which has been your objects created by address, don't need to malloc, you again use malloc allows you set up after the address, are covered in malloc your address, your input data to your address of malloc, and the structure of the main body and didn't do any action, is still empty! Remove the malloc that try!

CodePudding user response:

It is critical that you changed the PT in function, but you don't take out function, it is only in the function body effective
And never pass is value, not the variable itself
Although, you pass the address of the main variables inside and went in, but you don't change the address of the variable itself
Function inside the PT is only a temporary variable, and the main PT don't have a dime relationship between
Return to the main function, PT is the same PT, there is no change

Equivalent to you request a new memory function in the body, then changed the memory the data inside the
The function to return to the main function, the memory address is back, don't know where to throw, and then use the inside of the original PT data output, so it's no so

CodePudding user response:

I C language teacher taught us "by value", "reference",
  • Related