raman_klogius@ani.social to Programmer Humor@programming.devEnglish · 3 months agoHell yeahani.socialexternal-linkmessage-square15linkfedilinkarrow-up1217arrow-down11file-text
arrow-up1216arrow-down1external-linkHell yeahani.socialraman_klogius@ani.social to Programmer Humor@programming.devEnglish · 3 months agomessage-square15linkfedilinkfile-text
minus-squareSonotsugipaa@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up5·3 months agoThe cruelest part is not formatting it correctly :c #include <sys/types.h> #include <signal.h> #include <unistd.h> int main() { pid_t pid = fork(); if (pid == 0) { // Child process while (1); } else { // Parent process sleep(2); kill(pid, SIGKILL); // Force kill child printf("Child process killed.\n"); } return 0; }
The cruelest part is not formatting it correctly :c
#include <sys/types.h> #include <signal.h> #include <unistd.h> int main() { pid_t pid = fork(); if (pid == 0) { // Child process while (1); } else { // Parent process sleep(2); kill(pid, SIGKILL); // Force kill child printf("Child process killed.\n"); } return 0; }