My goal is to use the property of scanf()
function. I want to supress ':'
in the input to get the hours and minutes value into their respective variables hours_var
and minutes_var
.
#include<stdio.h>#include<string.h>void main(){ int hours_var,minutes_var; printf("Whats the time??\n"); scanf("%d*c%d",&hours_var,&minutes_var); printf("%d\n", hours_var); printf("%d\n",minutes_var);}
OUTPUT :
Whats the time??2:2420
I wanted 24 in the minutes_var
variable . What did I miss??