I am trying some random declarations of array pointers and function pointers together. I was struck here.
#include<bits/stdc++.h>
int add(int a,int b){
return 1729; }
int main(){
int (abc)(int,int);
abc = add;
return 0;
}
The emitted error is:
cannot convert 'int(int, int)' to 'int(int, int)' in assignment
But as both abc
and add
are of the same type, why should it convert? Or is it possible to assign functions to new variables? If so, how to do that?