Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need nelp with this kind of error in my 6 program to make it works: ve2.c:74:1: warning: control may reach end of non-void function

I need nelp with this kind of error in my 6 program to make it works:

ve2.c:74:1: warning: control may reach end of non-void function [-Wreturn-type]

image text in transcribed

Particulary in the 3 functions :

image text in transcribed

The code:

#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;

k = 96;

for (i = 0; i

{

k++;

for (j = 0; j

{

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

if (k == 123)

k = 97;

}

}

printf(" Enter message ");

fgets(message, 22, stdin);

printf(" Enter the key ");

fgets(key, 22, stdin);

for (i = 0; key[i] != '\0'; i++) //Use '\0', not NULL

{

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] != '\0'; i++) //Use '\0', not NULL

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

//decryption

for (i = 0; key[i] != '\0'; i++) //Use '\0', not NULL

{

c = findColumn(key[i]);

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

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

}

printf(" Message Retrieved is: ");

for (i = 0; emessage[i] != '\0'; i++) //Use '\0', not NULL

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

//decryption

for (i = 0; key[i] != '\0'; i++) //Use '\0', not NULL

{

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+1] != '\0'; 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);

}

}

output should be:

image text in transcribed

ve2.c:74:1: warning control may reach end of non-void function [-Wreturn-type] ve2.c:84:1: warning control may reach end of non-void function [-Wreturn-type] ve2.c:93:1: warning control may reach end of non-void function [-Wreturn-type] 3 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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

=+ (d) What is the flow rate in each circuit of part (c)?

Answered: 1 week ago

Question

How appropriate is it to conduct additional research?

Answered: 1 week ago