prev up next   top/contents search

comp.lang.c FAQ list · Question 12.9b

Q: What printf format should I use for a typedef like size_t when I don't know whether it's long or some other type?

A: Use a cast to convert the value to a known, conservatively-sized type, then use the printf format matching that type. For example, to print the size of a type, you might use

	printf("%lu", (unsigned long)sizeof(thetype));

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North