Pointer to function, C/C++ Programming

Pointer to function:

int mul(int a, int b, int c)

{

  return a*b*c;

}

void main()

{

  int (*function_pointer)(int, int, int);

  function_pointer = &mul;

  printf("\nThe product of three numbers is:%d", function_pointer(8, 3, 4));

  getch();

}

Output

859_pointer to string.png

Posted Date: 9/29/2012 7:02:21 AM | Location : United States







Related Discussions:- Pointer to function, Assignment Help, Ask Question on Pointer to function, Get Answer, Expert's Help, Pointer to function Discussions

Write discussion on Pointer to function
Your posts are moderated
Related Questions
Programming Assignment #3: Vehicle Track Performance Tests Purpose: The purpose of this programming assignment is to give the student experience in using functions, arrays, and str

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of π using a simulation method called "Monte Carlo". The following fi

Write a C program to input 16 numbers and print them out in a table format of 4 wide by 4 deep. E.g.   4    5    5    7   8    9    10    11   12    13    14    15   16    17

Which constructor gets called while I create an array of Fred objects?

Define a structure to store roll no, name and marks of a student. b) Using the structure of Q2. a), above write a ''C'' program to create a file "student.dat". There must be one r

To complete this assignment, edit the following constructors and methods: 1. public MaxPQ(Key[] keys) - change the following loop for (int k = N/2; k >= 1; k--) sink(k);

Explain the class invariant. - It's a condition that ensures correct working of a class and defines all the valid states for an object. - When an object is created class inv

A: A using declaration makes it possible to employ a name from a namespace without the scope operator.

Program is to find the area of room: Program is to find the area of room with default values using classes & object class room   {   private:     int len;     i

Define the Volatile Keyword Qualifiers in C Language? The volatile keyword proceed as a data type qualifier and a volatile variable is for dynamic use. E.G. for data that is to