954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ambigious part 5

LOOK THE FOLLOWING STATEMENT

int *p[]();

PLS TELL ME THE MEANING OF THIS STATEMENT.& WHERE WE USE THIS STATEMENT.

Sukhbir
Light Poster
31 posts since Jul 2004
Reputation Points: 11
Solved Threads: 0
 

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
  */
Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

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.

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

Good point too,the fourms are getting filled.Hey there's plenty of space in an ocean anyway.

FireNet
Posting Whiz in Training
258 posts since May 2004
Reputation Points: 108
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You