Program for Contiguous Allocation

Topics: Computer file, File system, Unicode Pages: 2 (317 words) Published: February 2, 2013
/Contiguous file allocation/
#include<stdio.h>
Int main()
{
char a[10][10];
int I,flb[10],sb[10];
for(i=1;i<=5;i++)
{
printf(“\nEnter the file name:”);
scanf(“%s”,&a);
printf(“\nEnter the starting block:”);
scanf(“%d”,&sb[i]);
printf(“\nEnter the file length in blocks:”);
scanf(“%d”,&flb[i]);
}
printf(“\n\nList of files\tstarting block\tfile length”); for(i=0;i<5;i++)
{
printf(“\n%s\t%d\t%d”,a[i],sb[i],flb[i]);
}
return 1;
}

/indexed allocation/
#include<stdio.h>
int main()
{
char a[10];
int i,1.b,a.b[10];
srintf(“\nEnter the file name:”);
Scanf(“%d”,&a);
printf(“\n\nIndexed block:”);
scanf(“%”,&ib);
for(i=1;i<5;i++){
printf(“\nEnter the child of index block%d:”,i);
scanf(“%d”,&c I b[i]);
}
printf(“\n\n\nThe list of files\t index block”);
printf(“\n\n%s\t%d”,a,ib);
printf(“\n\nThe above file utilization index block of child following!\n\n\t”); for(i=1;i<=5;i++){
printf(“%d\t”,c I b[i]);
}
return 1;
}

/linked allocation/
#include<stdio.h>
Int main()
{
char a[10];
int I,fb1[10],sb,eb;
printf(“\nEnter the file name”);
scanf(“%d”,&a);
printf(“\nEnter the ending block”);
scanf(“%d”,&ob);
for(i=0;i<5;i++){
printf(“Enter the free block %d”,i+1);
scanf(“%d”,&f b[i]);}
printf(“\n\nFile name\t starting block \t ending block”); printf(“\n\n%s\t%s\t%d\t%d”,a,&b,eb);
printf(\n\n%s file utilization of linked type of following block\n”,a); printf(“\n\n\n%d->”,&b);
for(i=0;i<5;i++){
printf(“%d->”,fb1[i]);}
printf(“%d”,eb);
return 1;}
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Program Essay
  • Program Essay
  • Essay on Program
  • Programs Essay
  • Essay on Asset Allocation: Index Funds
  • Employee Assistance Program proposal Essay
  • revenue allocation Essay
  • Essay about Cost Allocation

Become a StudyMode Member

Sign Up - It's Free