April 6th, 2013, 01:35 PM
C programming Question Help1
Write a simplified version of printf in which the two conversion specifications are %d and %s. Each %d in the the format string indicates an int argument and each %s indicates a char* (string) argument. If the function encounters a % character thatís not immediately followed by a d or s character, it should ignore both characters. The function should use calls of putchar to produce all output. You may assume that the format string doesnít contain escape sequences. Test your function with a C program
April 6th, 2013, 01:58 PM
For extra credit, when given the source your routine should verify the arguments passed match the format string. Yes, printf is variadic. Your version should be so as well.
Post again if you run into specific trouble with your algorithm or program. It's best if you post
)A minimal amount of code that exhibits the problem;
)Input that caused the trouble if you make it as far as runtime;
)Output you expected. That's critical. Would you believe that many of the posts here don't include "why it's a problem" information? In this case the problem appears well defined. Good start.
Last edited by b49P23TIvg; April 6th, 2013 at 07:09 PM.
[/code] are essential for python code and Makefiles!
April 6th, 2013, 06:41 PM
Pretty sure nobody here is going to do your homework for you. At least that's the way it should be. Have you got a specific question to ask?
Originally Posted by UnknownK
Why don't you get started by writing a function that finds all of the '%" symbols in a string passed in as a parameter and outputs the index of that symbol and the value of the following symbol? That might be a good starting point.
I no longer wish to be associated with this site.