New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Dynamic < Run Time > Memory Allocation


Posted Date:     Total Responses: 0    Posted By: PRITESH   Member Level: Bronze   Points/Cash: 4   


This is an Example of Runtime Memory allocation using MALLOC() & CALLOC()
STRCTURE


#include
#include
#include
#include


struct student
{
char nm[10];
int m1;
int m2;
int m3;
int total;
};

void main()
{
int n,i;
struct student *p;
clrscr();
printf(" Enter variables ");
scanf("%d",&n);
p=(struct student *)calloc(n,sizeof(struct student));
if(p==NULL)
{
printf(" Not Sufficient Memory ");
getch();
exit(0);
}
for(i=0;i {
printf("\n \n \t Enter Name M1 M2 M3 ");
scanf("%s%d%d%d",(p+i)->nm,&(p+i)->m1,&(p+i)->m2,&(p+i)->m3);

(p+i)->total=(p+i)->m1+(p+i)->m2+(p+i)->m3;
}

for(i=0;i {
printf(" \n \n \t NAME %s Total %d \n ",(p+i)->nm,(p+i)->total);
}
getch();

}


Project Feedbacks


No feedbacks found. Be the first to respond and make money from revenue sharing program.

Post Feedback
You must Sign In to post a feedback.
Next Project: Program on Maximum Precipitation Intensity – Duration Relation:
Previous Project: Module Pool Mathematical Calculation in ABAP-SAP

Return to Project Index

Post New Project


Related Projects



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.