Question of pointer function - Insert pointer function

#include <stdio.h>

void tell_me(int f(int));
int f(int);
int a(int);

void main()
{
    tell_me(a);
}

void tell_me(int (*f)(int))
{
    int x;

    if(f == (*a))
    {
            x = 1;
    }
    else
            x = 2;

    printf("%d\n", f(x));
}

int f(int j) 
{ 
return j * j;
}
int a(int j) 
{ 
return j * 4;
}

why this answer is 4?

I'm confused about a.

I think int a(int) = int (*f) (int) so a == f and change f to a so use int a j4

and int f look like a fake. because this is one of the exam in my class.

Is my logic correct?

Help me...



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation