943,892 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2431
  • C++ RSS
Aug 6th, 2004
0

ambigious part 5

Expand Post »
LOOK THE FOLLOWING STATEMENT

int *p[]();

PLS TELL ME THE MEANING OF THIS STATEMENT.& WHERE WE USE THIS STATEMENT.
Similar Threads
Reputation Points: 11
Solved Threads: 0
Light Poster
Sukhbir is offline Offline
31 posts
since Jul 2004
Aug 6th, 2004
0

Re: ambigious part 5

I believe it is invalid syntax. Did you mean a declaration for an array of pointers returning int and taking no parameters?
#include <iostream>
  
  int foo() { std::cout << "foo\n"; return 0; }
  int bar() { std::cout << "bar\n"; return 0; }
  
  int main()
  {
     int (*p[])() = {foo,bar};
     p[0]();
     p[1]();
     return 0;
  }
  
  /* my output
  foo
  bar
  */
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Aug 6th, 2004
0

Re: ambigious part 5

Sukhbir:

Can you please stop naming your threads "Ambiguous part #", and start naming them with a title that indicates what you're asking?

One of the keys to getting responses to your posts is to post a relevant topic to your question. "Ambiguous part #" is, well, ambiguous.
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003
Aug 6th, 2004
0

Re: ambigious part 5

Good point too,the fourms are getting filled.Hey there's plenty of space in an ocean anyway.
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: DECLARATION SYNTAX ERROR (for bc 31 user)
Next Thread in C++ Forum Timeline: storing large numbers





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC