Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 696343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:03:13+00:00 2026-05-14T03:03:13+00:00

Can anybody help me with this simple code?? #include <iostream> using namespace std; void

  • 0

Can anybody help me with this simple code??

#include <iostream>
using namespace std;

void testFunction(){
    cout<<"This is the test function 0"<<endl;
}

void testFunction1(){
    cout<<"This is the test function 1"<<endl;
}

void testFunction2(){
    cout<<"This is the test function 2"<<endl;
}

void (*fp[])()={testFunction,testFunction1,testFunction2};

int main(){

    //fp=testFunction;
    (*fp[testFunction1])();
    //cout<<"Addrees of the function pointer is:"<<*fp;
}

I am getting the following error:

error: invalid types `void (*[3])()[void ()()]' for array subscript|
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:03:13+00:00Added an answer on May 14, 2026 at 3:03 am

    You’re trying to use a function pointer as an array index. That won’t fly, array indices must be integer.

    To call through a function pointer, just call:

    (*fp[1])();
    

    or the (even shorter!)

    fp[1]();
    

    will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anybody help me solve this : i got $filename= index 198.php; i use
Can anybody please help me with this as I have no idea why public
Console dogs me. Can anybody help? The sad story starts like this. My OS
Can anybody show me (maybe copy/paste a simple code example) how to create the
Can any one help me. I have this ‘unmanaged’ .NET code, which works on
can any body help me on separating this example of data that i need
Can anybody help me to build an XSD file to validate XMLs like these:
Can anybody help me out to know the possible reasons for which Apple store
Can anybody help me in finding out how to verify that _tmkdir succeeded. For
Can anybody help how to setup a automatic backup of mysql database and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.