I recently moved from windows to linux i was used to learn c++ with Visual-studio, now i try to write something in linux and it behaves different for example:
#include <iostream>
#include <iomainip>
int main(){
char a {'a'};
char* b { &a };
size_t count {16};
for(size_t i{};i < count;i++){
std::cout << std::hex;
std::cout << b << ": " // This line need to show me the pointer address but it
<< *(b+=i) << " " // output the value in linux
<< *(b+=i+1) << " "
<< *(b+=i+2) << " " // if i use &b it show me the address, but i remember that
<< *(b+=i+3) << " " // for values not for pointers
<< std::endl; // and *(b+=i) not change the address why?
}
return 0 ;
}
the out put is :
a: a
: X �
: B
: X �
: �
: Y �
: � �
��: �
: @
:
: �
: $ � �
: �
: � �
: � �
: � �
i just want to print memory to the console in format of " Address: Val1 Val2 Val3 Val4 "