confused with pointers

Hello to everyone,well i am trying to make a pointer to a function.Firstly the following code works just fine:

#include<iostream>
using namespace std;

void a(int k){cout<<"I am :"<<k<<"years old"<<endl;};
void (*b)(int l);

int main()
{
b=&a;

return 0;
}

But since i can declare a pointer in many ways (int* a,int *a,int (*a)) i thought i could do the same with my pointer to the function.So i rewrited the code with one litle difference :

void a(int k){cout<<"I am :"<<k<<"years old"<<endl;};
void* b(int l); //different way of decleration

int main()
{
b=&a;

return 0;
}

and my compiler returns me error C2659: '=' : overloaded function as left operand.

Why i have this error?I thought that it was the same thing!Thank you
Nope. The parentheses are mandatory. Your second declaration of b (void* b(int l);) declares a function, not a function pointer.
ok helios thanks for your sunbeam
Topic archived. No new replies allowed.