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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hi, which software companys will take,if d candidate's % is jst 55%?

1668


I need testPalindrome and removeSpace #include #define SIZE 256 /* function prototype */ /* test if the chars in the range of [left, right] of array is a palindrome */ int testPalindrome( char array[], int left, int right ); /* remove the space in the src array and copy it over to the "copy" array */ /* set the number of chars in the "copy" array to the location that cnt points t */ void removeSpace(char src[], char copy[], int *cnt); int main( void ) { char c; /* temporarily holds keyboard input */ char string[ SIZE ]; /* original string */ char copy[ SIZE ]; /* copy of string without spaces */ int count = 0; /* length of string */ int copyCount; /* length of copy */ printf( "Enter a sentence:\n" ); /* get sentence to test from user */ while ( ( c = getchar() ) != '\n' && count < SIZE ) { string[ count++ ] = c; } /* end while */ string[ count ] = '\0'; /* terminate string */ /* make a copy of string without spaces */ removeSpace(string, copy, ©Count); /* print whether or not the sentence is a palindrome */ if ( testPalindrome( copy, 0, copyCount - 1 ) ) { printf( "\"%s\" is a palindrome\n", string ); } /* end if */ else { printf( "\"%s\" is not a palindrome\n", string ); } /* end else */ return 0; /* indicate successful termination */ } /* end main */ void removeSpace(char src[], char copy[], int *cnt) { } int testPalindrome( char array[], int left, int right ) { }

2217


What do you mean by recursion in c?

630


Is main is user defined function?

599


What is "Hungarian Notation"?

639






I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

1907


How to declare a variable?

575


What is typedef?

681


What is data type long in c?

627


Is null a keyword in c?

739


What are the different properties of variable number of arguments?

669


Why is c still so popular?

619


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

815


Is it possible to initialize a variable at the time it was declared?

758


Explain the binary height balanced tree?

728