Error 1 error C2373: 'strange' : redefinition; different type modifiers

I am having trouble with debugging this program, it keeps saying that 'strange' is unresolved external, and i dont understand what that means.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;


int x;
int y;
int strange; 
int main()
{
	int strange (int x, int y);
	{
		if(x>y)
			return x/y;
		else 
			return y/x;

	}
	system("pause");
	cout << strange(4,8) << endl;
	
}


Pull the definition of the function strange out of the main function.

Is line 11 supposed to be a function prototype? It looks like a global variable not function.
Last edited on
I was trying to initialize strange so I can not get an error, but it didn't work, but thank you, now i know :D
one more thing...

1
2
3
4
5
6
7
8
int strange (int x, int y);// <-- remove semicolon here
{
		if(x>y)
			return x/y;
		else 
			return y/x;

}
Last edited on
Topic archived. No new replies allowed.