2011-05-23, 12:37 AM
dante9898 Wrote:This reminded me that i had to look up ways to find how to know when a number is even or odd while making algorithms (And later coding it), and now i remembered how to calculate multiples of any number to boot too
Modulo for both?
dante9898 Wrote:Im still fairly new to programing and have to restart my education of it because of a few problems that i won't bother mention, but someone would be nice to explain this to me? "printf( "%d\n", x)" only one that didn't understand exactly what it says (I can guess, sort of, but i would rather know exactly what it is).
C is a low level language, it does not have any natural ways to print values without explicitly casting them into a character string via a format conversion function like printf. The other languages you can just say print @variable and the engine knows to bring the value of the variable, but with C you have to be more specific, because print requires a character string and x is a number, therefore you need to convert x into a character string to print it, either via that function, or a more torturous route such as creating a character array and printing to that array the value of the variable. Could've possibly done a print( itoa(x)); as well.
It's not having what you want - It's wanting what you've got.


