Showing posts with label Array Using Malloc In C. Show all posts
Showing posts with label Array Using Malloc In C. Show all posts

Friday, 26 October 2012

Program Of Data Entry Or Add Records Using C

#include<stdio.h> 
#include<conio.h>
 
#include<string.h>
 
{
 

char name[40];
 

int age;
 

float bs;
 

};
 

main()
 

{
 

clrscr();
 

FILE *fp;
 
struct emp e;
 
char s[80];
 
char another='y';
 
if(fp==NULL)
 
{
 
printf("Can't Open File");
 
exit(1);
 
}
 
printf("\n File  TEXT Is=");
 
printf("\n");
 
printf("\n Enter Name,AGE,Basic salary");
 
scanf("%s",e.name);
 
scanf("%d",&e.age);
 
scanf("%f",&e.bs);
 
printf("Add Another Record(y/n)");
 
another=getche();
 
}
 
fclose(fp);
 
getch();
 
}

Wednesday, 17 October 2012

Program Of Array Using Malloc In C

#include<stdio.h>
#include<conio.h>
 
main()
 
{
 
int *a,i,n;
 
clrscr();
 
printf("How many Blocks U want to Create For Array =");
 
scanf("%d",&n);
 
for(i=0;i<n;i++)
{
 
}
 
for(i=0;i<n;i++)
 
{
 
printf("a[%d]==> ",i);
 
scanf("%d",&a[i]);
 
}
 
printf("\n==============Array is==============\n");
 
for(i=0;i<n;i++)
 
{
 
}
 
getch();
 
}