Bit Stuffing Program in C

#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,count=0;
char databits[80];
printf("Enter Data Bits: ");
scanf("%s",databits);
printf("\nData Bits After Bit stuffing: ");
for(i=0; i<strlen(databits); i++)
{
if(databits[i]=='1')
count++;
else
count=0;
printf("%c",databits[i]);
if(count==5)
{
printf("0");
count=0;
}
}
getch();
}

Output:

Bit Stuffing Program in C

One comment

  • Great explanation of bit stuffing! The code snippets were really helpful, and I appreciate how you broke down each step. It made the concept much clearer for me. Looking forward to more posts like this!

Leave a Reply

Your email address will not be published. Required fields are marked *