does anyone know if it possible to have something like
#DEFINE NUM_DEC 4
printf("This is your value:%.NUM_DECf\n");
thanks in advance
Its impossible because anything other than data type specifiers and escape characters within double quotes of printf function is treated as string or character constant and is printed as it is in output.
I believe, your real requirement, is to set variable precision for your floating point number.
The bad news is you can't do it that way.
The good news is there is another way. printf("This is your value:%.*f", 4, 22./7); Follow the link to know how it works
Or are you looking for something like this?
#define st "String 2"
int main ()
printf("Str 1 "st);//equivalent to printf("str 1 %s", st)
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...