문제

I have the following code:

volatile unsigned int * address;
char * array="0x10000008";

Please tell me, what is a correct way of writing the "array" value to "address" variable?

도움이 되었습니까?

해결책

You could use sscanf:

#include <stdio.h>

sscanf(array, "%p", &address);

or strtoull:

#include <stdlib.h>

address = (unsigned int *)strtoull(array, NULL, 0);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top