Computer Science, asked by himanshu3660, 1 year ago

How to call a function without using function name to send parameters?


PJRStudies: in which language?

Answers

Answered by PJRStudies
0

In which language? in c: func().

in java: func() . in definition, do this:

int func()

insetead of int func(int x)

(int can be anything)

(func is a name)

Answered by nikamkhushi114
0

Answer:

By using function pointers

Explanation:

function pointer is a pointer that points to the function or  rather the executable code. Pointer stores the the address of the function.

like here *fun_ptr is a pointer

void (*fun_ptr)(int) = &fun;

Invoking fun() using fun_ptr  

   (*fun_ptr)(10);

you can send parameters without using name of the function

Similar questions