I want to use variables to specify format of printf
in C programming.
I am quite a C programming newbie, having practiced bash shell scritps though.
In bash scripts, I can use a variable to specify format of printf
as one below.
#!/bin/bash
### Variable
format="%4s%4d %8s\n"
### Main
printf "$format" $1 $2 $3
Then, Is there similar way like the above in C programming?
Is it possible in C?
The strings for the printf
format include characters and numbers.
I have heard C programming uses different declaration for each of them; i.e. int or char.