c语言,使用malloc分配空间,一直访问冲突,怎么解决

一直访问冲突,实在没办法

img

scanf("%d", &price[i]); 加上&


#include<stdio.h>
#include <stdlib.h>
int main(){

    int *price,n,i;
    scanf("%d",&n);
    while (n != 0)
    {
        price = (int*)malloc(sizeof(int) * 9);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &price[i]);
        }
        for (int i = 0; i < n; i++)
        {
            printf("%d", price[i]);
        }
        free(price);
    }
}