Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Regarding dyanamic allocation of memory

Reply
Thread Tools

Regarding dyanamic allocation of memory

 
 
prati prati is offline
Junior Member
Join Date: Aug 2012
Posts: 8
 
      08-05-2012
i have written one small c programme for dynamic memory allocation.But when programme runs memory is not getting allocated. So its output is only "error".So what could be the problem?

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
int *array;
clrscr();
array=(int*)malloc(sizeof(int));
if(array==NULL);
{
printf("error");
return;
}
*array=6;
printf("%d",*array);
free(array);
getch();
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
static memory allocation versus dynamic memory allocation Ken C Programming 24 11-30-2006 12:37 AM
What is the difference between dynamic memory allocation,and stack allocation ? chris C++ 6 10-28-2005 05:27 AM
Re: creating Dyanamic splash screen Frank ASP .Net 0 03-12-2005 06:03 PM
Re: creating Dyanamic splash screen Peter Jausovec ASP .Net 0 03-12-2005 01:23 PM
Dyanamic User Controls. Sundar ASP .Net 1 11-21-2003 03:08 PM



Advertisments