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

How many types of linked lists what are they? How many types of data structures?

18 Answers   BSNL, Pivotal Software,


What do you mean by team??

5 Answers   Student,


code for quick sort?

0 Answers  


Without using main fn and semicolon,print remainder for a given number in C language

2 Answers  


Do you know what are bitwise shift operators in c programming?

0 Answers  






how would a 4*3 array A[4][3] stored in Row Major Order?

0 Answers   HCL, Ignou,


What does return 1 means in c?

0 Answers  


Why c is called free form language?

0 Answers  


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

0 Answers   TCS,


which one is highest Priority in c? a)=,b)+,c)++,d)==

4 Answers  


Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)

1 Answers  


What is pointer in c?

0 Answers  


Categories