When trying to print a pointer, for example
#include <stdio.h>
main() {
int a = 3;
printf("The address : %p\n", &a);
printf("As an hex : %x\n", &a);
return 0;
}
I get a 000000ac4f5ffd58
and the nice 4f5ffd58
(the first two characters mismatch is from unknown origin). It's just for comfort and beauty, the %x
"works" to display it. Is there any way to have the correct (0x4f5ffd58
) way to print my pointer (its format) ?
I'm using CLion (I resetted the settings), and here is the CMakeLists.txt
associated with it :
cmake_minimum_required(VERSION 3.22)
project(untitled C)
set(CMAKE_C_STANDARD 99)
add_executable(untitled main.c)