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

Explain what is the benefit of using const for declaring constants?

0 Answers  


Method Overloading exist in c ?

3 Answers   Wipro,


What are the data types present in c?

0 Answers  


how to print a statement in c without use of console statement ,with the help of if statement it should print

2 Answers   Satyam,


What is the difference between char a[] = "string"; and char *p = "string"; ?

14 Answers   Adobe, Honeywell, TCS,


What are bitwise shift operators in c programming?

0 Answers  


Determine if a number is a power of 2 at O(1).

2 Answers  


1. Write the function int countchtr(char string[ ], int ch); which returns the number of times the character ch appears in the string. Example, the call countchtr(“She lives in NEWYORK”, ‘e’) would return 3.

4 Answers  


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

0 Answers  


What is memory leak in c?

0 Answers  


Explain how do you search data in a data file using random access method?

0 Answers  


What language is lisp written in?

0 Answers  


Categories