Solved

array as pointer passing to function

Posted on 2000-04-30
4
179 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now