I writing a code for a clock and I’m creating a function to display the time which is stored in an array time[]
char time[]="23:59:45 ";
char display_time(char *t[], char *, char *, char *);
void main(void)
{
display_time(&time, &hr, &min, &sec);
GLCD_GoTo(5,3);
GLCD_WriteString(time, Font_System7x8);
}
and this is my function
char display_time(char *t[], char *h, char *m, char *s)
{
*t[0]=*h/10+48;
*t[1]=*h%10+48;
*t[3]=*m/10+48;
*t[4]=*m%10+48;
*t[6]=*s/10+48;
*t[7]=*s%10+48;
}
Everything compiles fine but my time isn’t getting update and only the initialized value is being displayed.
(int, char*[])or(), but NOT(void)'0'instead of 48, again for lisibilitydisplay_timedoesn’t “display time”, write a better name for the function and you’re done 🙂.