yeah i know how to add im having trouble with the function, im not gettin the numbers added when i call it and not sure if i use a for loop or what?
Somethings very fishy here!
Your functions name is "print", but you call something called "printf()":
which should have given you a compiler error a mile wide!Code:printf(string1);//call function to print out information
If you aren't receiving compiler errors, you need to fix that with your compiler. If you *are* receiving compiler errors, you need to pay attention to them.
Fix this, and post up a sample of your input and output, please, so we're all on the same page here.
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
It looked to me like he meant to call his own function "print", but misspelled it as printf, just out of C syntax habit.
I don't understand why you'd have a note about "//calling the function", in the code, when you were just using printf() to print one char string. BFD.
if i call my original print function wont it print the numbers is reverse order since i did that before? i dont think i have the numbers set up to add correctly. im changing my add function call in main to
add(p, q);
It could be a mistake - using prinf insttead of home made print
It could be a bad habbit - using custom string in printf instead of
which is more stable and thus should be recomended.Code:printf("%s", string1);
But it is not my point - my point was - compiler could not determine the first error because the prototype of the printf was match.
Maximum it could warn about the second issue - but it should be very sofisticated compiler
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
i cant print out the two numbers i want to add still with the add(p, q);
Can you post what the code is right now? Also, please explain is your problem in the printing of the strings, the printing of the answer, or getting the two strings of digits added together into one sum?
Vart: I've never seen printf() with just a pointer inside, and no formatting info. If you say it works, that's good enough for me.
This would be the case when the format string has no format specifiers. The pointer is presumably a pointer to the first character of the format string.Originally Posted by Adak
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Well - that's just wrong! ROFL!!
Sure Tabstop - start the highly technical, complex arguments. What a pal you are!!