returning pointer to a structure in C

前端 未结 4 365
情书的邮戳
情书的邮戳 2021-01-26 12:11

this program returns a pointer to a structure.
When i print the contents, the name is not being displayed properly, where as the other tw

4条回答
  •  后悔当初
    2021-01-26 12:44

    You created stu locally on the stack in your create function. When you returned from that function, the stack was popped, invalidating the data you pointer points to.

提交回复
热议问题