code:
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
// PROTOTYPE THE FUNCTONS & DECLARE VARIABLES
int multiply(int ,int);
void get_input(int , int);
int input1;
int input2;
int answer;
// RUN THE MAIN PROGRAMME
int main(void)
{
// EXECUTE GET_INPUT FUNCTION
get_input(input1, input2);
// EXECUTE MULTIPLY FUNCTION
multiply(input1, input2);
}
// DEFINE GET_INPUT FUNCTION
void get_input(input1, input2)
{
printf("give me 2 integers\n");
do
{
input1 = get_int("Integer 1: ");
input2 = get_int("Integer 2: ");
}
while ((input1 || input2) <= 0);
}
// DEFINE THE MULTIPLY FUNCTION
answer multiply(input1, input2)
{
int answer = (input1 * input2);
printf("%i", answer);
}
errors:
~/Week_2/Practice/ $ make functionpractice
clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow functionpractice.c -lcrypt -lcs50 -lm -o functionpractice
functionpractice.c:36:20: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
void get_input(input1, input2)
^
functionpractice.c:13:9: note: previous declaration is here
int input1;
^
functionpractice.c:36:28: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
void get_input(input1, input2)
^
functionpractice.c:14:9: note: previous declaration is here
int input2;
^
functionpractice.c:55:5: error: unknown type name 'answer'
answer multiply(input1, input2)
^
functionpractice.c:55:21: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
answer multiply(input1, input2)
^
functionpractice.c:13:9: note: previous declaration is here
int input1;
^
functionpractice.c:55:29: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
answer multiply(input1, input2)
^
functionpractice.c:14:9: note: previous declaration is here
int input2;
^
functionpractice.c:59:13: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
int answer = (input1 * input2);
^
functionpractice.c:15:9: note: previous declaration is here
int answer;
^
6 errors generated.
<builtin>: recipe for target 'functionpractice' failed
make: *** [functionpractice] Error 1