Question: I GET THIS ERROR WHEN I RUN THIS CODE. The assignment is to find the bug using gdb. HERE IS THE CODE #include /*Read a

 I GET THIS ERROR WHEN I RUN THIS CODE. The assignment

I GET THIS ERROR WHEN I RUN THIS CODE. The assignment is to find the bug using gdb.

HERE IS THE CODE

#include

/*Read a set of values from the user.Store the sum in the sum variable and return the number of values read.*/

int read_values(double sum) {

int values=0,

input=0;

sum = 0;

printf("Enter input values (enter 0 to finish): ");

scanf("%d",&input);

while(&input != 0) {

values++;

sum += input;

scanf("%d",input);}

return sum;

}

int main() {

double sum=0;

int values;

values = read_values(sum);

printf("Average: %g ",sum/values);

return 0;

}

gcc version 4.6.3 main.c: In function 'main': main.c:25:14: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit- function-declaration] if (lgets (strl)) ( fgets /tmp/ccfko25j.o: In function "main': main.c: (.text+0x91): warning: the gets' function is dangerous and should not be used. strl rr str2 rr The result of appending str2 to strl is rrrr. strlrwrr The result of appending str2 to strl is rwrrwrwr. strldad str2 mom The result of appending str2 to strl is dadmomwr. strl

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!