It does change the result.Originally Posted by pkt-zer0
Visual Studio of course... And i know you'll comment that but i have my resons to restricting all my windows projects to visual C++... lol
What kind of compiler are you using?Works perfectly, compiled with g++. Static variables are zeroed out anyway, so you could just set its first three elements to '3', not bothering to include a terminating zero, and it would still work.
And yes... Auto 0ed out... But when you do that, it demands that it is the same size. "333" is 4 bytes, because i'd be trying to store that 4 byte thing into a 5 byte thing, problem for compiler.
But you're not using it to store anything other than an address... And does that morse thing work for C++ also?
Download Links:
Links are hidden from guests. Please register to be able to view these links. First part reads a sample file, associating the characters with morse codes. Then it displays those codes appropriate for each keypress. No error checking, memory cleanup, and that sort of stuff, but you get the idea. And yes, kohlrak, it uses... pointers!
It depends on how it's implemented in the standard library. Most common would be to go character-by-character on the two strings, calculate the difference of the characters ASCII codes, and if it's not zero, return it, otherwise continue comparing.
The reason you can't put a string in a single variable to handle it is that C uses zero terminated strings, unlike Pascal, where the first byte of a string was its length. You can have arbitarily long strings in C (as in: possibly a hundred gazillion letters long), but obviously you can't have arbitarily large variables (int, long int, and the like have an implementation defined size)
Dude, i don't mean the standard library. I mean C++ itself. This can be done and checked without any of the standard library. It's an IF statement... Buuuuuuuuuuuuut... Wouldn't that take longer than one big number? One would think when they make it they'd make it so they could compare all values at once if possible.