GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 214 of 255    Print  
what is the difference between function pointer and pointer to function?

why we use static variable as a global instead of defining it a local?


  
Total Answers and Comments: 2 Last Update: March 28, 2006     Asked by: vimal gupta 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 15, 2006 22:53:24   #1  
venkatesh        

RE: what is the difference between function pointer an...

we can create a pointer to function. so we can call the function with that pointer.

eg

let us take two functions

void sum(int a,int b);

void sub(int a,int b);

we can create pointer to these functions

void (*p)(int,int);

p=sum

p(3,2)------gives the sum of two numbers

p=sub

p(3,2) ---gives the difference of two numbers

I am not having that much idea about function pointer.


 
Is this answer useful? Yes | No
March 28, 2006 07:49:21   #2  
Yash        

RE: what is the difference between function pointer an...
Both are one and the same thing.
 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Hi, This is a typical example of reflection. If you are using .NET then use reflection for this purpose. In this case you create an object of a particular  type and the invoke methods at run time by passing function name. ...

Latest Answer : pass multiple variables to the function as formal parameters ... function will actually set those values (output variables). ...

Latest Answer : The basic difference in C and C++ structures is :1) In C , default access for structure members is public2) In C++ , defaulot access for structres is private ...

Latest Answer : overloading is mainly for operators and overriding is for functions ...

Latest Answer : Arrays have to difine with fixed size it will not grow dynamically , vector size can be increased bydynamically and vectors are synchronized.yaa always right.vector is a standard template library in C++. Vector size can be increased dynamically and stores ...

Explain "passing by value", "passing by pointer" and "passing by reference"
Tags : Pointer

Latest Answer : Calloc:- #include void *calloc(size_t nelem, size_t elsize);The calloc() function allocates space for an array of nelem elements of size elsize. The space is initialized to zero. Malloc:#include void *malloc(size_t size);The malloc() function allocates ...

Latest Answer :     printf is the standart function in (c) programming language library for printing  formatted output.egprintf writes the resulting string to the standard output(remember, Awk has only one output file).So, for example: printf("%sn","jellotHarold!")prints ...

Latest Answer : Both aggregation and composition are special kinds of associations. Aggregation is used to represent ownership or a whole/part relationship, and composition is used to represent an even stronger form of ownership. With composition, we get coincident lifetime ...

Latest Answer : Sequence diagrams describe interactions among classes in terms of an exchange of messages over time. Collaboration diagrams represent interactions between objects as a series of sequenced messages. Collaboration diagrams describe both the static structure ...


 Sponsored Links

 
Related Articles

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960’ s The term object oriented programming’ was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

C++ Void Pointer and Null Pointer

C Void Pointer and Null Pointer In this C tutorial you will learn about two interesting types of pointers; void pointers and Null Pointer These pointers will be discussed in conjunction with syntax usage and example mosgoogle center Pointer to Void General Syntax void pointer variable; Void is use
 

C++ Static Functions

C Static Functions Static member functions have a class scope and they do not have access to the this pointer of the class When a member is declared as static a static member of class it has only one data for the entire class even though there are many objects created for the class The main usage of
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

C++ Function Passing Types

C Function Passing Types In this C tutorial you will learn about function passing types two types of arguments passing in functions passed by value  and  passed by reference are discussed here mosgoogle center The arguments passed to a function can be performed in two ways Passed
 

What is DECODE function used for?

DECODE is used to decode a CHAR or VARCHAR2 or NUMBER into any of several different character strings or numbers based on value. That is DECODE does a value-by-value substitution. For every value that is given in the DECODE function it makes an if then check and matches the value. The general format
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf("%d",printf("%d %d %d", a,a,a)); } In this above program the inner printf i
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

How does the function call within function get evaluated?

Whenever we have more than one function which is called for a finite number of times then such a function gets evaluated from inside out. Let us understand this concept with an example. For instance consider a function sample called within it 4 times as given in program below: main() { int a=50;
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape