I'm writing a simple task reminder program in c which prints the given task after the certain amount of time. Here is a small portion of the code that I'm having problem with. Basically I'm having trouble with scanf() as the function is acting strangely.
#include <stdio.h>
#include <time.h>
int main(){
int hour,minute,curr_time,end_time;
printf("input the hour and minute after which alarm will start in HH:MM : \n");
scanf("%d:%d", &hour,&minute);
char task[50];
printf("Name of the task: \n");
scanf("%s" , task);
printf("your task is %s" , task);
return 0;
}
Now when I compile and run the program , the following occurs.
~$ ./a.out
input the hour and minute after which alarm will start in HH:MM :
00.56
Name of the task:
your task is .56
I cannot input the name of the task. As soon as I finish giving the hour and minute , the program ends without taking the task input.