A frame is a digital data transmission unit in computer networking and telecommunication. A frame typically includes frame synchronization features consisting of a sequence of bits or symbols that indicate to the receiver the beginning and end of the payload data within the stream of symbols or bits it receives. If a receiver is connected to the system in the middle of a frame transmission, it ignores the data until it detects a new frame synchronization sequence.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct frame{
int fslno;
char finfo[20];
};
struct frame arr[10];
int n;
void sort()
{
int i,j,ex;
struct frame temp;
for(i=0;i<n;i++)
{
ex=0;
for(j=0;j<n-i-1;j++)
if(arr[j].fslno>arr[j+1].fslno)
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
ex++;
}
if(ex==0) break;
}
}
void main()
{
int i;
clrscr();
printf("\n Enter the number of frames \n");
scanf("%d",&n);
for(i=0;i<n;i++)
{ arr[i].fslno=random(50);
printf("\n Enter the frame contents for sequence number
%d\n",arr[i].fslno);
scanf("%s",arr[i].finfo);
}
sort();
printf("\n The frames in sequence \n");
for(i=0;i<n;i++)
printf("\n %d\t%s \n",arr[i].fslno,arr[i].finfo);
getch();
}
OUTPUT
Enter the number of frames:3
Enter the frame contents for sequence number 23
Wrote
Enter the frame contents for sequence number 45
Program
Enter the frame contents for sequence number 9
Vikas
The frames in sequence
9 Vikas
23 Wrote
45 Program