This question was asked to me in an interview.
they asked me how to generate a core dump file with which i can debug. then i said that with -g flag in
-g
The -g flag tells the compiler to generate debugging information. It has no impact on whether or not a core file will be generated. On most unix-like systems, that can be setup using the ulimit command.