`return 0x1;` 是什么意思? [英] What does `return 0x1;` mean?

查看:43
本文介绍了`return 0x1;` 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网页上浏览项目的源代码时,我发现 main 中的一些 return 语句对我来说很奇怪:

When browsing the source of a project on web I've found some return statement in main that looks weird to me:

int main()
{
    /* ... */
    return 0x1;
}

所以 main 返回 0x1 radix 16,但那是 1 radix 10!main 不应该返回 0 吗?

So main is returning 0x1 radix 16, but that's 1 radix 10! Shouldn't main return 0?

这是不正确的,对吧?顺便return 0x0可以吗?

That is incorrect, right? By the way is it Okay to return 0x0?

推荐答案

它返回1.0x1只是一个十六进制值1.

It returns 1. 0x1 Is just a hex value of 1.

您也可以自由地返回 0x0.这只是 0 的不同表示.如果你愿意,你也可以使用八进制:)

You are free to return 0x0, too. It's just a different representation of 0. You could use octal, too, if you like :)

这篇关于`return 0x1;` 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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