What does `return 0x1;` mean?

Viewed 73745

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;
}

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

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

11 Answers

0x1 is simply 1 in terms of hex.

0x signifies that the number is in hex form.

You can get the same behavior if you try the below code:

int main()
{
    /* ... */
    return 1;
}
Related