函数返回未分配给变量 [英] function return not assigned to a variable
本文介绍了函数返回未分配给变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果调用(非无效)函数但不将其返回值分配给变量怎么办?例如getchar();
What if you call a (non-void) function, but don't assign its return value to a variable? e.g., getchar();
我一直想知道这样的值会发生什么.我听过幽默的解释,例如它降到了以太"等等,但是我真的很想知道.有什么办法可以恢复这样的价值?谢谢
I've always wondered what happens to such a value. I've heard humorous explanations like "its gone to the ether" and so forth, but I'd really like to know really. Would there be any way to recover such a value? Thanks
推荐答案
不,您不会.
该值从堆栈中弹出并消失.
The value gets popped off the stack and is gone.
如果需要返回值,则应将其分配给变量.
If you need the return value, you should assign it to a variable.
这篇关于函数返回未分配给变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文