0

hi i am doing crc coding for c and cant get the remainder and dataword +remainder= codeword
any help here

#include <stdio.h>
#include<stdlib.h>
#include <conio.h>
int main()
{
int a[20],b[20],c[20],i,k,j,n,s=0,t=0;
printf ( "Welcome to the CRC Encoder/Decoder!\n");
printf ( "press n to exit at anytimes\n");
	 /* do{*/
	
		  
printf("enter size of dataword\n");
scanf("%d",&n);
printf("enter dataword to be transfer bit by bit\n");
for (i=0;i<n;i++)
{
scanf("%d",&a[i]);


}
printf("your input dataword is\n");
for (i=0;i<n;i++)
{
	
printf("%d\n",a[i]);
}
printf("enter size of divisor\n");
scanf("%d",&k);
printf("enter divisor to be transfer bit by bit\n");
for (j=0;j<k;j++)
{
scanf("%d",&b[j]);


}
printf("your input divisor is\n");
for (j=0;j<k;j++)
{
	
printf("%d\n",b[j]);
}



for (i=0;i<(k-1);i++)
{
a[n+i]=0;
}
printf("the augmented dataword\n");
for (i=0;i<(k+n-1);i++)
{
printf("%d\n",a[i]);
}

/*i guess this is wrong but i tried to get the remainder by using modulo 2 like ( a ^ b )*/
for (i=0;i<k;i++)
{
c[i]=a[i];
}
for (t=0;t<(n-1);t++)
{
for (j=1;j<k;j++)
{

c[j-1]=c[j]^b[j];
c[j]=a[k+s];


return 0;
}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by sixstringartist
0

If you want a prompt (or existent) reply, I suggest you refactor your code to include better variable names.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.