How to shift the bytes from an address. If i am storing the characters "ABCDEF" in 16-bit address starting from 0x210A.
0x210A - 'A'
0x210B - 'B'
0x210C - 'C'
0x210E - 'E'
0x210F - 'F'
These i want to shift 10 times. Nothing but, this need to store in from 0x2100
0x2100 - 'A'
0x2101 - 'B'
0x2102 - 'C'
0x2103 - 'E'
0x2104 - 'F'
I know shifting can be done with taking one variable. i want to shift byte from one address to other.
You can just use memmove , eg like this:
#include <string.h>
const char * src = (char *)0x210a; // source address
char * dst = (char *)0x2100; // destination address
const size_t len = 5; // no of bytes
memmove(dst, src, len);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.