byte
#include<stdio.h>
int main()
{
int n;
printf("\nEnter number of bits : ");
scanf("%d",&n);
int statbyte[8]={0,1,1,1,1,1,1,0};
int new[n];
for(int i=0;i<n;i++){
scanf("%d",&new[i]);
}
int stuffed[24];
for(int i=0;i<24;i++){
if(i>=0&&i<=7){
stuffed[i]=statbyte[i];
}
else if(i>=8&&i<=15){
stuffed[i]=new[i-8];
}
else if(i>=16&&i<=23){
stuffed[i]=statbyte[i-16];
}
}
printf("\nStuffed bit : ");
for(int i=0;i<24;i++){
printf("[%d]",stuffed[i]);
}
return 0;
}
Comments
Post a Comment