How can I call a function, given its name as a string?

Answers were Sorted based on User's Feedback



How can I call a function, given its name as a string?..

Answer / alice

You can't. You have to construct a table of two-field
structures, where the first field is the function name as a
string, and the second field is just the function name
(which the compiler will convert to its calling address).
Then search the table to get a string match in the first
field, and use the second field to call the function.

Is This Answer Correct ?    3 Yes 1 No

How can I call a function, given its name as a string?..

Answer / ashay

Ashay here according to the programming scenario u cannot
give a function the name of a system defined identifier and
string is a system defined identifier and as aresult of
which u r unable to call

Is This Answer Correct ?    9 Yes 8 No

How can I call a function, given its name as a string?..

Answer / neeraj

#include<stdio.h>
#define string sum1()
int main(){

int k=string;
printf("%d",k);
getch();
return 0;

}
sum1()
{
int c=6;
int d=7;
return(c+d);
}

Is This Answer Correct ?    0 Yes 1 No

How can I call a function, given its name as a string?..

Answer / hemant ware

A function can be called by object name and a function
name (sring ) with dot(.) operator.
e.g
class hi
{
void string()
{
cout<<"hello I am in string function";
}
};
void main()
{
hi h1;
h1.string();
}

Is This Answer Correct ?    12 Yes 46 No

Post New Answer

More C Interview Questions

what does data structure mean?

8 Answers  


What is the difference between text files and binary files?

0 Answers  


Explain what are binary trees?

0 Answers  


What is the most efficient way to store flag values?

0 Answers  


Blade logic interview question. 1st round is a written tests with 15 multiple questions from c and c++. All are simple basic question. Like int main () { Int i=65; Return printf(ā€œ%cā€, i); } 2nd and 3rd round is technical interview. The position for which I was interview was core UNIX and c. Yes it is for system programming. The company has product name blade server. For their server they are creating their own command for their purpose. Example cd command. We can implement it in a c program by using the chdir() function. So the question asks related to PID, fork, pipe, shared memory, signal. Write a program in c which will act as cp command.

1 Answers   BladeLogic, Infosys,






Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

0 Answers   Huawei,


In C language, a variable name cannot contain?

0 Answers  


What is the collection of communication lines and routers called?

0 Answers  


Is that possible to store 32768 in an int data type variable?

0 Answers  


What does volatile do?

0 Answers  


How arrays can be passed to a user defined function

0 Answers  


Can we declare variable anywhere in c?

0 Answers  


Categories