Professional Documents
Culture Documents
JAMIA HAMDARD
Computer Science and Engineering
Submitted To :
Submitted By:
Md Zeeshan Ahmed
Enrolment no. - 2020-310-117
Section: B 6th Semester
Dept. of SEST, Jamia Hamdard
Lab 2
To implement and check the error detection/error correction techniques in networks using
a c program.
Code
#include<stdio.h>
#include<stdlib.h>
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n;
int redundentbits;
scanf("%d",&n);
scanf("%d",&redundentbits);
int *MessageWord = (int*)malloc(n*sizeof(int));
int *CodeWord = (int*)malloc((n+redundentbits)*sizeof(int));
printf("Message Word : ");
for(int i=0;i<n;i++){
scanf("%d",(MessageWord+i));
CodeWord[i] = MessageWord[i];
printf("%d\t",MessageWord[i]);
}
Output