It compiles, but you do get warnings:
$ gcc -Wall -o ptr ptr.c
ptr.c: In function ‘main’:
ptr.c:9:11: warning: unused variable ‘wtf’ [-Wunused-variable]
FILE *wtf = fopen("wat", "wb");
^
ptr.c:11:5: warning: ‘ptr’ is used uninitialized in this function [-Wuninitialized]
wat(ptr);
^
And if you enable the address sanitizer, it will not execute without errors:
$ gcc -fsanitize=address -o ptr ptr.c
$ ./ptr
=================================================================
==3280==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000040080d sp 0x7ffffa1f4940 bp 0x7ffffa1f4950 T0)
#0 0x40080c in wat (/tmp/ptr+0x40080c)
#1 0x400843 in main (/tmp/ptr+0x400843)
#2 0x7fa048110b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
#3 0x4006f8 (/tmp/ptr+0x4006f8)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ??:0 wat
==3280==ABORTING
But yeah, C by default does not come with safety.