J
john
Hi, at first the code doesn't seem to work. Any ideas?:
#include <iostream>
#include <cstdlib>
int main()
{
using namespace std;
int x= 7;
char *p= reinterpret_cast<char *>(&x);
for(size_t i= 0; i< sizeof(x); ++i)
cout<< p<< '\n';
}
Two more questions.
Q1) Is the above char * use guaranteed to work with all POD types?
Q2) If I remember well, unsigned char * covers more types. Am I wrong,
and it covers only POD types?
Thanks in advance.
#include <iostream>
#include <cstdlib>
int main()
{
using namespace std;
int x= 7;
char *p= reinterpret_cast<char *>(&x);
for(size_t i= 0; i< sizeof(x); ++i)
cout<< p<< '\n';
}
Two more questions.
Q1) Is the above char * use guaranteed to work with all POD types?
Q2) If I remember well, unsigned char * covers more types. Am I wrong,
and it covers only POD types?
Thanks in advance.