Breaking News

Sunday, 13 December 2015

Malloc

//---------------------------------------------------------------------------

#pragma hdrstop
#include<iostream.h>
#include<conio.h>
#include<malloc.h>

//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{       int *p=(int *) malloc (5* sizeof(int));
        p[0]=2;
        p[1]=3;
        p[2]=4;
        p[3]=5;
        p[4]=6;

        for(int i=0; i<5; i++)
        {       cout<<p[i]<<" ";
        }

        getch();
        return 0;
}
//---------------------------------------------------------------------------

No comments:

Post a Comment

Designed By Fakhri Akbar