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");
malloc的使用、用malloc动态分配内存以适应用户的需求的源代码实例
猜你喜欢
转载自www.cnblogs.com/hi3254014978/p/9459229.html
今日推荐
周排行