PDA

View Full Version : Hex values in C



Nevermore
10-03-2004, 04:56 PM
does anyone know how to use hex values for ints in C? i have some int values that i need to print as hex characters, how might i do this? thanks for any help.

Nevermore
10-03-2004, 07:18 PM
nevermind, figured it out. instead of printing the variable with

printf("%d",x);

you just have to use a %x instead of the %d, and it converts it to hex.

camperz0
10-03-2004, 10:53 PM
right.. ;) :roll: ;)

aclays
01-19-2005, 01:33 PM
mmm, i just learned how to do that yesterday, how much c have you taken nevermore?

Nevermore
01-19-2005, 02:45 PM
my object oriented class this semester is my fourth class in either C or C++, so... alot. :)

aclays
01-19-2005, 03:11 PM
:D kool kool :headbang:

Nevermore
01-20-2005, 05:16 PM
so are you taking a class in C right now? if so, what level/ what subject are you learning?

Reve
01-20-2005, 09:47 PM
why C though? does it have any advantages over C++? I took C++ and now i'm taking java and I've been told that java actually works very much like C; but ofcourse then you have all the advantages of javascript in web development etc.

aclays
01-21-2005, 10:11 AM
it's an intro to C class. first quarter of it too.. my school decided to use C as the intro to programming language, they say it's the base for a lot of other languages, such as c++, perl and java for example.

I'm only on my third week so far, but my professor has an excellent teaching style, and is very patient with us. I'm starting to enjoy it hehe, especially after i got a bunch of studying out of the way and knew what he was talking about :P

Nevermore
01-22-2005, 02:18 AM
C is only better than C++ as a starting point because then you have to learn the hard way how to do some things.... makes you understand how it works a little better.
The syntax (sp?) between java, C, C++ is pretty much the same. the difference is in how the code actually works, what it actually generates in machine code, and what a lot of the commands mean.
for example,

#include <beer.h>

in C, this means to include a header file named beer.h that contains information necessary to compile and run the program.
in Java, this is a server-side include to whatever the hell the person is doing.
when written on a man's mug, it means hes a drunk nerd. :)

DVD-Man
01-22-2005, 02:26 AM
include('beer.php');

PHP's includes! :headbang:

Nevermore
01-22-2005, 02:31 AM
lol. :headbang: