LOOK THE FOLLOWING STATEMENT

int *p[]();

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

Recommended Answers

All 3 Replies

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
  */

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.