-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinked.c
More file actions
39 lines (39 loc) · 826 Bytes
/
Copy pathlinked.c
File metadata and controls
39 lines (39 loc) · 826 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
#include<stdio.h>
#include<stdlib.h>
int main()
{
int f[50],p,i,j,k,a,st,len,n,c;
for(i=0;i<50;i++)
f[i]=1;
printf("Enter how many blocks that are allocated:\t");
scanf("%d",&p);
printf("\n Enter the blocks nos that are already allocated");
for(i=0;i<p;i++)
{
scanf("%d", &a);
f[a]=0;
}
X:
printf("Enter the starting index block and length:\t");
scanf("%d%d",&st, &len);
k=len;
for(j=st;(k+st);j++)
{
if(f[j]==1)
{
f[j]=0;
printf("\n%d->%d",j,f[j]);
}
else
{
printf("\n %d->block is already allocated",j);
k++;
}
}
printf("\n Do you want to enter another file?(yes-1/no-0)");
scanf("%d",&c);
if(c==1)
goto X;
else
exit(0);
}