printf misconception

Andrew Koenig ark at alice.UUCP
Sun Aug 18 00:34:49 AEST 1985


Jeff Anton says:

>	Not really, you are forgetting that the format "%.8s" will
> cause printf to print up to a null or 8 chars max.  Unfortunately
> this style of printf can not be used with sizeof for compile time
> format changes without run time code support.

This is untrue.  How about:

	printf ("%.*s", sizeof(thing), thing);



More information about the Comp.lang.c mailing list