int len; int i = 0; printf("please enter the size that you want: "); scanf("%d", &len); int *pArr = (int*)malloc(sizeof(int) * len); printf("please cin the elements:\n"); for(i = 0; i < len; i++) { scanf("%d", &pArr[i]); } for(i = 0; i < len; i++) { printf("%d ", pArr[i]); } printf("\n");