User forums > Using Code::Blocks

print variable address

(1/2) > >>

Mich:
Hello,
I would like to display the memory address of an array. I have this small C code:

--- Quote ---unsigned char NameTab[] = "D:\\data\\util2\\myTest.DAT";
printf("addr NameTab %X\r\n", NameTab);

--- End quote ---
I have this warning at compilation:
warning: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'unsigned char *' [-Wformat=]

Do you have any suggestion to display the memory address of a variable by a printf?

Best regards

ToApolytoXaos:
Mich, this has nothing to do with Code::Blocks, but rather how to use C programming language. I'm sure there are many books, let alone websites that show you a few ways to get an address of a variable.

Mich:
I have this warning only with codeblocks ....

Jenna:

--- Quote from: Mich on August 05, 2014, 04:20:16 pm ---I have this warning only with codeblocks ....

--- End quote ---
http://wiki.codeblocks.org/index.php?title=FAQ-General#Q:_What_Code::Blocks_is_not.3F

And please (re-?)read the rules of this website:

--- Quote from: MortenMacFly on January 24, 2009, 09:14:54 pm ---[...]
2. Compiler/Linker errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.
[...]
Finale note: Ignoring these rules may result in the topic being (silently) locked and/or even removed completely without any notice.
[...]

--- End quote ---
You accepted to follow these rules when registering here, so please do it !

Mich:
Ok
I guess that I am not the first people to confuse so may be you know the compiler forum url. If yes, could you indicate it please?
Best regards
Michel

Navigation

[0] Message Index

[#] Next page

Go to full version