square root

R

Rick C. Hodgin

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main(void)
{
float f;

f = sqrt(16.0f);
printf("%f\n", f);

return 867-5309;
}

:)
 
J

James Kuyper

[...]
int main(void)
{ [...]
return 867-5309;
}

:)

Isn't that UB? (Or is it implementation-defined?)


"return x;" from main() results in x being passed to exit(). The
standard specifies, for exit(status), that "If the value of status is
zero or EXIT_SUCCESS, an implementation-defined form of the status
successful termination is returned. If the value of status is
EXIT_FAILURE, an implementation-defined form of the status unsuccessful
termination is returned. Otherwise the status returned is
implementation-defined."

Note, in particular, that on systems where there are multiple possible
"successful termination" statuses, 0 and EXIT_SUCCESS are neither
required to produce the same "successful termination" status, nor
prohibited from doing so.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top