python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
How can I print out the first and second byte of a member inside a struct?
How can I printf() out the first & second byte of a member inside a struct in one line?
//example
int aNum=513;
int main(){
printf("\n %02i %02i",((char*)&aNum)[0],((char*)&aN...

user14570759
Votes: 0
Answers: 1
c programming question on reinterpret_cast
What is the reinterpret_cast of (char) doing here?
unsigned int aNumber = 258; // 4 bytes in allocated memory [02][01][00][00]
printf("\n is printing out the first byte %02i",(char)aNumber...

dn70a
Votes: 0
Answers: 1
Is it allowed to reinterpret cast from ptr of parent type to ptr of child type if the child class adds no data members or virtual methods?
Is this allowed?
#include <iostream>
class Foo {
public:
int a;
int b;
};
class Bar : public Foo
{
// NO data members added
public:
inline int sum() const { return a+b;};
};
...
bradgonesurfing
Votes: 0
Answers: 0
Is it possible to change value of a constant variable via reinterpret_cast?
all. I have read a code snippet from a book where the author tries to set the value of a register via direct memory access (he simulates this process). He used reinterpret_cast<volatile uint8_t*>...
BHOS
Votes: 0
Answers: 3