C program demonstrating use of signal and alarm system call and signal handler function

#include<stdio.h>#include<signal.h>#include<stdlib.h>typedef void (*sighandler_t)(int);void signal_handler(int signum){printf("nn Sorry Time Outnn");exit(0);}int main(){char uname[20],passwd[20];signal(SIGALRM, signal_handler);printf("nEnter your Username and Password");alarm(10);scanf("%s %s",uname,passwd);printf("nnUsername: %s n Password:%s n You Have Logged In Successfully.. ",uname,passwd);return 0;}



Popular posts from this blog

MATLAB code for Circular Convolution using Matrix method

Positive number pipe in angular 2+