Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with the 7 errors in my c program to make it run: #include //#include char arr[26][26]; char message[22],key[22],emessage[22],retMessage[22]; int findRow(char); int findColumn(char);

I need help with the 7 errors in my c program to make it run:

#include

//#include

char arr[26][26];

char message[22],key[22],emessage[22],retMessage[22];

int findRow(char);

int findColumn(char);

int findDecRow(char,int);

int main()

{

int i=0,j,k,r,c;

// clrscr();

k=96;

for(i=0;i

{

k++;

for(j=0;j

{

arr[i][j]=k++;

if(k==123)

k=97;

}

}

printf(" Enter message ");

gets(message);

printf(" Enter the key ");

gets(key);

// Encryption

for(i=0;key[i]!=NULL;i++)

{

c=findRow(key[i]);

r=findColumn(message[i]);

emessage[i]=arr[r][c];

}

emessage[i]='\0';

printf(" Encrypted message is: ");

for(i=0;emessage[i]!=NULL;i++)

printf("%c",emessage[i]);

//decryption

for(i=0;key[i]!=NULL;i++)

{

c=findColumn(key[i]);

r=findDecRow(emessage[i],c);

retMessage[i]=arr[r][0];

}

retMessage[i]='\0';

printf(" Message Retrieved is: ");

for(i=0;emessage[i]!=NULL;i++)

printf("%c",emessage[i]);

//decryption

for(i=0;key[i]!=NULL;i++)

{

c=findColumn(key[i]);

r=findDecRow(emessage[i],c);

retMessage[i]=arr[r][0];

}

retMessage[i]='\0';

printf(" Message Retrieved is: ");

for(i=0;retMessage[i]!=NULL;i++)

printf("%c",retMessage[i]);

getchar();

return(0);

}

int findRow(char c)

{

int i;

for(i=0;i

{

if(arr[0][i]==c)

return(i);

}

}

int findColumn(char c)

{

int i;

for(i=0;i

{

if(arr[i][0]==c)

return(i);

}

}

int findDecRow(char c,int j)

{

int i;

for(i=0;i

{

if(arr[i][j]==c)

return(i);

}

}

the errors are :

image text in transcribed

The out should be

image text in transcribed

ve3.c:28:17: warning comparison between pointer and integer 'int' and void for (i 0 key [i] LL i++) ve3.c:36:22: warning comparison between pointe and integer 'int' and void for (i 0; emessagelij LL i++) ve3.c:39:17: warning comparison between pointe and integer 'int' and void for (i 0 key [i] LL i++) ve3.c 47:24: warning comparison between pointe and integer int and void for (i 0: retMessage il LL i++) ve3.c:60 1: warning control may reach end of non-void function [-Wreturn-type] ve3.c:69 1: warning control may reach end of non-void function [-Wreturn-type] ve3.c:78:1: warning control may reach end of non-void function [-Wreturn-type] 7 warnings generated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions