Solved

array as pointer passing to function

Posted on 2000-04-30
4
182 Views
Last Modified: 2010-04-02
in the following  code what heppand in particuler..
char *(*fun( int ))(void);??!!
and what code
char *string(void) mean???
then give up example of class template.
0
Comment
Question by:fathikhid
4 Comments
 
LVL 1

Expert Comment

by:ntdragon
ID: 2763488
about the first it look like a pointer to function but it look too weird

about the second it a function named string that returns a char* and gets a pointer

about the template

template <class T>
class myclass{
T i;
public:
myclass(T x):i(x){}
~myclass(){}
}
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 2763623
The first one might be a pointer to a function that returns a pointer to a function. But I don't like such declarations and would prefer to see them typedefed in understandable pieces, like
typedef char* (*FuncPtr)(int);
typedef FuncPtr (*FP2)();
FP2 fun;

I think the second one is a function named string that returns a char* and takes no arguments.
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2763659
I'm looking at an "unscrambler algo" for weird definitions and the first, by this algo, says

"fun is a function taking an int parameter returning a pointer to a function taking no parameters returning a char *"

The second one ntdragon and kangaroo have already said what it is.

   Glenn

0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 2764205
fathikhid , i can send you pointer tutprial with reply to same(and more complex) Q. Write you EMail, if you want it.
 
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question