cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
why does not return error?
why does not return error?
Sep 29, 2010 at 11:29am UTC
kikirikou
(65)
Hi, i use MS visual studio 6 and i wrote the following code:
#include<iostream>
using namespace std;
void something(int a,char b);
int main()
{
return 0;
}
void something(char a,char b) //Here is a different decleration
{
cout<<"i am something \n";
}
if I don't initiallize "something()" in main with values the compiler does not return me any error or warning. Why is that??? (thanks)
Sep 29, 2010 at 11:51am UTC
LB
(13399)
1. You don't "initialize" functions...
2. You're just overloading a function, but only the first overload is visible from main.
3. You will get a linker error about
void
something(
int
a,
char
b);
because you never define it after you initialize it.
Oct 1, 2010 at 6:02am UTC
kikirikou
(65)
Ok,thanks ;)
Topic archived. No new replies allowed.