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.