#include #include #include float a = 0; void handler(int signum, siginfo_t *info, void *ptr) { printf("%s value of variable is %f\n", __func__, a); } int main(int argc, char *argv[]) { struct sigaction sig; float f = 10, g = 10.1f; memset(&sig, 0x00, sizeof(sig)); sig.sa_sigaction = handler; sig.sa_flags = SA_SIGINFO; sigaction(SIGTERM, &sig, NULL); sigaction(SIGINT, &sig, NULL); printf("f is %f g is %f\n", f, g); while(1) { sleep(1); printf("Double value is %f\n", a); a += 0.1f; } return 0; }