Suppose on my platform sizeof(int)==sizeof(void*) and I have this code:
sizeof(int)==sizeof(void*)
printf( \"%p\", rand() );
Will this be undefined behavior
Yes, it's undefined. From C++11, 3.7.4.2/4:
The effect of using an invalid pointer value (including passing it to a deallocation function) is undefined.
with a footnote:
On some implementations, it causes a system-generated runtime fault.