Skip to main content
fist -> first
Source Link
Joundill
  • 7.8k
  • 13
  • 40
  • 54

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

Cast the literal as a pointer to the type.

and

De-reference using the prefix *.

Same technique applies also to other types.

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_bytefirst_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

Cast the literal as a pointer to the type.

and

De-reference using the prefix *.

Same technique applies also to other types.

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

Cast the literal as a pointer to the type.

and

De-reference using the prefix *.

Same technique applies also to other types.

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char first_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Method A is very clear and succinct. Added a few short explanations so it may be more apparent.
Source Link

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

Cast the literal as a pointer to the type.

and

De-reference using the prefix *.

Same technique applies also to other types.

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

Cast the literal as a pointer to the type.

and

De-reference using the prefix *.

Same technique applies also to other types.

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

implicit conversion from int to char* is illegal in C.
Source Link
Peter Cordes
  • 376.9k
  • 50
  • 742
  • 1k

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

2. Assign the address to a pointer:

char* pointer = 0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Two ways:

1. Cast the address literal as a pointer:

char value = *(char*)0xff73000; 

2. Assign the address to a pointer:

char* pointer = (char*)0xff73000; 

Then access the value:

char value = *pointer; char fist_byte = pointer[0]; char second_byte = pointer[1]; 

Where char is the type your address represents.

Source Link
Zdeněk Gromnica
  • 883
  • 2
  • 15
  • 31
Loading