Question #5895   Submitted by Answiki on 02/22/2022 at 07:01:54 PM UTC

In C, what is the value of RAND_MAX?

Answer   Submitted by Answiki on 02/22/2022 at 07:05:18 PM UTC

En C, the value of RAND_MAX depends of the compiler or library implementation.

For portability reasons, the standard requires this value to be greater than or equal to 32767.


To know the value on a given compiler, simply run the following code:

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

int main()
{
    printf("%d", RAND_MAX);
    return 0;
}

3 events in history
Answer by Answiki on 02/22/2022 at 07:05:18 PM

En C, the value of RAND_MAX depends of the compiler or library implementation.

For portability reasons, the standard requires this value to be greater than or equal to 32767.


To know the value on a given compiler, simply run the following code:

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

int main()
{
    printf("%d", RAND_MAX);
    return 0;
}

Answer by Answiki on 02/22/2022 at 07:04:20 PM

En C, the value of RAND_MAX depends of the compiler or library implementation.

For portability reasons, the standard requires this value to be greater than or equal to 32767.


To know the value on a given compiler, simply run the following code:

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

int main()
{
    printf("%d", RAND_MAX);
    return 0;
}

Question by Answiki 02/22/2022 at 07:01:54 PM
In C, what is the value of RAND_MAX?
# ID Query URL Count

Icons proudly provided by Friconix.