Solved

array as pointer passing to function

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ assignment question 7 169
Writing a parser for java language 4 71
Socket Programming (Unix) 8 119
Issues with C++ Class 19 81
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

895 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

14 Experts available now in Live!

Get 1:1 Help Now