How can I call a function, given its name as a string?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
define function
if function is declared as static in one source file, if I would like to use the same function in some other source file...is it possible....how ?
What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }
what are the facialities provided by you after the selection of the student.
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
Explain function pointer with exapmles.
/*what is the output for the code*/ void main() { int r; r=printf("naveen"); r=printf(); printf("%d",r); getch(); }
C program to find frequency of each character in a text file?
what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){ case 4:a+=a*r; case 3:a+=a*r; case 2:a+=a*r; case 1:a+=a*r; } } a.computes simple interest for one year b.computes amount on compound interest for 1 to 4 years c.computes simple interest for four year d.computes compound interst for 1 year
Program to swap the any two elements in an array containing N number of elements?
1 Answers Bosch, Glenwood, Ugam Solutions,
Why c is called top down?
Magic square