Data type | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Data type

What is the data type of an address and how can be manipulated directly by user? More clarification by an Ex; I have an address like 00CFFCFC and i wanna manipulate it to 00CFFCFD so what’s the data type of it and how can i make that change?

16th Jun 2019, 12:57 AM
Masoud HMD
Masoud HMD - avatar
4 Answers
+ 5
for the handling in python this may be helpful: addr = '00CFFCFC' print(addr) x = 1 val1 = int(addr, 16) +1 print(hex(val1).upper()) https://code.sololearn.com/c8169L90DayF/?ref=app
16th Jun 2019, 6:26 AM
Lothar
Lothar - avatar
+ 4
Typically an int. Some languages such as c++ have "pointer arithmetic" meaning adding 1 to a pointer to an int will increment it by 4 bytes (the size of a 32bit int)
16th Jun 2019, 1:25 AM
Jackson O’Donnell
+ 4
I doubt direct memory access is supported in Python (mentioned in Relevant Tags). In C/C++ (also mentioned in Relevant Tags) there is the pointer type, whose size depends on platform (32bit or 64bit). Pointer is a special type designed to store memory address, and through this address one can manipulate data in memory.
16th Jun 2019, 2:01 AM
Ipang
+ 1
guys 1st of all thanks for the answers but still i didn’t get the right answer, pointers are type of data that we determine what they should be and they are pointing and referring to the assigned address so as all basically know, memory allocations are automatically done for empty mem locations as per request and each time it changes to diff address and these addresses are diff at each system so i’m ganna ask the question with another Ex; suppose that we are asking for the datatype double so the memory allocation will be 8 bytes assuming the address frm 00CFFCF0 to 00CFFCF8 bites, now i wanna manipulate the address to get access to 00CFFCF1 or i intend to change the double allocation address to start frm 00CFFCF1 to 00CFFCF9 for any reason, (note that this is just an Ex for clarification purpose and here there’s no possibility to explain main goal) so now what are we do?
16th Jun 2019, 1:00 PM
Masoud HMD
Masoud HMD - avatar