O my bad lol . <| sep |> A segmentation fault means the program tried to access memory outside its address space . It occued because you passed an integer where a pointer was expected , and that integer doesn ' t point to valid memory . Dereferencing an invalid pointer is undefined behaviour it is not guaranteed to result in a segfault or anything else , it can just silently corrupt memory . The compiler cannot detect the type mismatch , because scanf is a variadic function the format string is parsed when the function is called and only then does it know what the argument should be . In general , the compiler will not pick up on invalid memory accesses or other undefined behaviour it will just assume it doesn ' t happen and generate code accordingly .