C malloc 用法
生活随笔
收集整理的這篇文章主要介紹了
C malloc 用法
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
#include <stdio.h>
#include <malloc.h>
//用malloc實(shí)現(xiàn)一位數(shù)組
int main()
{int len;int i,b;int * p = (int *)malloc(3+ len);printf("請(qǐng)輸入數(shù)組個(gè)數(shù):");scanf("%d",&len);printf("請(qǐng)輸入要存儲(chǔ)的數(shù)字:");for( i=0;i<len;i++){scanf("%d",&p[i]);}for( b=0;b<len;b++){printf("%d\n",p[b]);}return 0;
}
總結(jié)
以上是生活随笔為你收集整理的C malloc 用法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PySpark中RDD与DataFram
- 下一篇: c 语言 二叉树