警告:格式指定类型为“ unsigned int”,但参数的类型为“ unsigned int *”

时间:2019-06-20 17:24:44

标签: c int

为什么要发出警告?

错误

警告:格式指定类型为'unsigned int',但参数的类型为'unsigned int *'

代码

#include <stdio.h>
#include <stdlib.h>

#define SIZE 10

void memory() {
    int *memory = (int*)malloc(sizeof(int) * SIZE);
    for (int i = 0; i < SIZE; ++i)
    {
        memory[i] = i;
        printf("0x%x -> array[%d] = %d\n",  &memory[i], i, memory[i]);
    }
    free(memory);
}

int main(int argc, char const *argv[])
{
    memory();
    system("sleep 10");
    return EXIT_SUCCESS;
}

enter image description here

0 个答案:

没有答案