LRC Code
LRC Code
#include<conio.h>
#include<stdio.h>
char data[64];
int fram[64],frames;
int msg[8][8],m[8][8]; //maximum 7 frames
int len;
void sender()
{
int length,i,j,k,count,bit,s,p;
clrscr();
frames=0;
printf("\n\n\t\t---------------Sender Side---------------\n\n");
if(count%2==0)
msg[i][j]=0;
else
msg[i][j]=1;
}
printf("\n\nCalculation of LRC:\n\n");
for(i=0;i<frames;i++)
{
for(j=0;j<=7;j++)
{
printf("%d ",msg[i][j]);
}
printf("\n\n");
}
int receiver()
{
int i,j,k,cnt,f1=0;
printf("\n\n\t\t---------------Receiver Side---------------\n\n");
if(cnt%2==0)
{
if(m[i][j]==0)
f1=1;
else
{
f1=0;
printf("\n\nData rejected...(1)!!!");
return(0);
}
}
else
{
if(m[i][j]==1)
f1=1;
else
{
f1=0;
printf("\n\nData rejected...!!!");
return(0);
}
}
}
if(f1==1)
{
printf("\n\nOriginal data : ");
for(i=0;i<frames;i++)
{
for(j=0;j<=6;j++)
{
printf("%d",m[i][j]);
}
printf(" ");
}
}
printf("\n\nData accepted...");
return 0;
}
void main()
{
clrscr();
sender();
receiver();
getch();
}
Output: