Thread: Printf
View Single Post
  #3   Spotlight this post!  
Unread 18-01-2006, 01:41
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Printf

Quote:
Originally Posted by BillyJ
Is there a simple explanation as to how to get printf working correctly?
Unless it's changed this year and I haven't had a chance to check, the printf function supplied is a partial implementation. For instance, no %f or %ld specifiers. And you have to be careful to make sure the passed argument list exactly matches the size of the specifiers in the string or very funny things can happen. Since printf takes a variable number of arguments, the compiler can't do strict type checking for you. All it can do is make sure the first argument passed is a string. For instace if you want to print the numerical value contained in a char, you need to cast it to an int if you specify %d.