-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.c
More file actions
41 lines (41 loc) · 851 Bytes
/
Copy pathindex.c
File metadata and controls
41 lines (41 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<stdio.h>
#include<stdlib.h>
int f[50], i ,j, k, inde[50], n, c, count=0, p;
int main()
{
for(i=0;i<50;i++)
f[i]=1;
X:
printf("Enter index block:\t");
scanf("%d", &p);
if(f[p]==1)
{
f[p]=0;
printf("Enter the files on index block\t");
scanf("%d",&n);
}
else
{
printf("block alredy allocated\n");
goto X;
}
for(i=0;i<n;j++)
scanf("%d",&inde[i]);
for(i=0;i<n;i++)
if(f[inde[i]]==0)
{
printf("block already allocated;");
goto X;
}
for(i=0;i<n;i++)
f[inde[j]]=0;
printf("\n allocated");
printf("\n file indexed");
for(k=0;k<n;k++)
printf("\n %d->%d:%d",p ,inde[k], f[inde[k]]);
printf("Enter 1 to enter more files and 0 to exit\t");
scanf("%d",&c);
if(c==1)
goto X;
exit(0);
}