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 nil mean in c?

0 Answers  


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

0 Answers   ADP,


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

0 Answers  


how do you programme Carrier Sense Multiple Access

0 Answers  


Can you write a programmer for FACTORIAL using recursion?

0 Answers   ADP,






What is %d called in c?

0 Answers  


List some basic data types in c?

0 Answers  


define c

6 Answers   HCL, TCS,


what are the compilation steps? ( i want inside the compiler )

2 Answers  


Using which language Test cases are added in .ptu file of RTRT unit testing???

0 Answers  


write a programme to enter some number and find which number is maximum and which number is minimum from enterd numbers.

3 Answers  


What is a program?

0 Answers  


Categories