Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
1K views3 pages

Bit Stuffing

It's an important topic in computer networks that explains safety of packets transferring from one node to another.

Uploaded by

Saurav Poonia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views3 pages

Bit Stuffing

It's an important topic in computer networks that explains safety of packets transferring from one node to another.

Uploaded by

Saurav Poonia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

5.

Bit Stuffing
AIM: To understand the concept of Bit Stuffing using C program.

Bit stuffing is the insertion of one or more bits into a transmission unit as a way to provide signaling
information to a receiver. The receiver knows how to detect and remove or disregard the stuffed bits. This
is used when a communication protocol requires a fixed frame size. Bits are inserted to make the frame
size equal to the defined frame size.

Fig: Example of Bit Stuffing

C program to illustrate Bit Stuffing


#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

int a[20],b[30],i,j,k,count,n;
printf("Enter frame size (Example: 8):");

scanf("%d",&n);

printf("Enter the frame in the form of 0 and 1 :");

for(i=0; i<n; i++)

scanf("%d",&a[i]);

i=0;

count=1;

j=0;

while(i<n)

if(a[i]==1)

b[j]=a[i];

for(k=i+1; a[k]==1 && k<n && count<5; k++)

j++;

b[j]=a[k];

count++;

if(count==5)

j++;

b[j]=0;

i=k;

}
else

b[j]=a[i];

i++;

j++;

printf("After Bit Stuffing :");

for(i=0; i<j; i++)

printf("%d",b[i]);

getch();

OUTPUT FOR BIT STUFFING:


Enter frame size (Example: 8): 12

Enter the frame in the form of 0 and 1: 0 1 0 1 1 1 1 1 1 0 0 1

After Bit Stuffing: 0101111101001

RESULT: We have successfully implemented the C program and understood the concept of Bit Stuffing.

You might also like