I'm trying to create a char array in a similar way as using a printf
statement.
If I do this:
printf("%d:%d:%.2f", hours, minutes, time);
It will print out exactly how I want it. However I'm now trying to store this as a variable. I've been trying to do something like the line of code below, however I get a "invalid initializer" error for char.
What I'm trying to do:
char temp[] = ("%d:%d:%.2f", hours, minutes, time);
I've also messed with strncat
and couldn't figure that out either. Any guidance is appreciated!