Yes. You need to know what font your output device is using.
Standard C has no functions for querying a font, but your platform will. Since getting the width of a string is such a common requirement, there will almost certainly be a function which does this directly. The hard part is often specifying the font.