Hi all,

please anybody help me in solving the following questions:
1)What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

2)What is the difference between the functions rand(), random(), srand() and randomize()?

Regards,
Prashanth

1)What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

The NULL macro is a symbolic name for a null pointer constant. It is defined something like this:

``#define NULL ((void*)0)``

or this:

``#define NULL 0``

2)What is the difference between the functions rand(), random(), srand() and randomize()?

rand() returns a pseudo random number between 0 and RAND_MAX. srand() seeds the random number generator that rand() uses so that the same sequence is not generated each time. Under the hood rand() and srand() work something like this:

``````static int __seed;

void srand(int seed)
{
__seed = seed;
}

int rand()
{
int r = {cool math using __seed};

++__seed;

return r;
}``````

random() and randomize() are not part of the C library, but if a compiler supports them they probably work similarly to rand() and srand().