我如何通过函数用C返回多个值吗? [英] How can I return more than one value through function in C?

查看:68
本文介绍了我如何通过函数用C返回多个值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人问我在采访一个人如何能够从函数返回多个值。我回答说,通过使用指针就可以实现(通过引用调用),这C.然后他告诉我,他正在寻找返回多个值的其他方式。我说我们可以返回一个结构对象,但这里也是他似乎并没有成为IM pressed。

I have been asked in an interview how one can return more than one value from function. I have answered saying by using pointers we can achieve(call by reference) this in C. Then he told me he is looking for some other way of returning more than one value. I said we can return a struct object but here also he didn't seem to be impressed.

我想知道别人的方式从一个函数返回多个值。

I would like to know others ways to return more than one value from a function.

我看到这里被问上所以这个问题,但找不到任何特定于C。

I have seen this questions being asked here on SO, but could not find anything C specific.

推荐答案

最棘手的问题是,面试官有一些解决方案,他们特别高兴,在思想和他们是你是否有同样的巧妙伎俩他们可能分级您还是不行。

The tricky problem is that the interviewer has some solution they are particularly happy with in mind and they are likely grading you by whether you have the same clever trick as them or not.

您可能只是仅举几方面,如你做,但仍不能落在他们的秘招。如果你知道自己的密招,你很可能不能与它pssed IM $ P $。

You could just name a few ways such as you did, and still not fall upon their secret trick. And if you knew their secret trick, you could well not be impressed with it.

因此​​,在这些情况下,其将其从采访到谈话。一旦你发现你没有对他们的自我感动,你能避免对航向恐吓我不知道,我放弃,而是尝试一下,让你有什么聪明的解决方案?是否有一个IN-房子配方在此XYZ公司?等等。

So in these situations, its to turn it from interview into conversation. Once you detect you're not moving towards their ego, you can avoid heading towards the intimidating "I don't know" "I give up" and instead try out the "so do you have any clever solution? Is there an in-house recipe for this at Xyz Inc?" etc.

在其明显的自我IM pressed溶液中的任何一瞥,你又回到坚固的地面上,你可以谈论它,并问他们是否有想过浮现在脑海中,基本上采访他们的各种因素。

Any glimpse at their obviously self-impressed solution and you are back on firm ground where you can talk about it and ask them if they have thought about various factors that come to mind and basically interview them.

每个人都喜欢一个很好的倾听者,并让他们谈论他们的招数是让他们离开采访throughly IM $ P $与你pssed的好方法! ;)

Everyone loves a good listener, and getting them to talk about their tricks is a good way to get them to leave the interview throughly impressed with you! ;)

这篇关于我如何通过函数用C返回多个值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆