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

  • SEARCH
  • Home
  • 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 583155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:45:47+00:00 2026-05-13T14:45:47+00:00

This was asked to me in an interview! i really got confused How do

  • 0

This was asked to me in an interview!
i really got confused

  • How do I declare an array of N
    pointers to functions returning
    pointers to functions returning
    pointers to characters

could anybody please help?

  • 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-13T14:45:47+00:00Added an answer on May 13, 2026 at 2:45 pm

    Typedefs are for wusses. Here’s a straightforward, mechanical method for figuring out hairy declarations:

              a                 -- a
              a[N]              -- is an N-element array
             *a[N]              -- of pointers
            (*a[N])()           -- to functions
           *(*a[N])()           -- returning pointers
          (*(*a[N])())()        -- to functions
         *(*(*a[N])())()        -- returning pointers
    char *(*(*a[N])())()        -- to char.  
    

    So, the answer is in the neighborhood of char *(*(*a[N])())();. I say “in the neighborhood” since it’s never specified what arguments the functions take.

    It’s an obnoxious interview question (types this ugly are truly rare IME), but it does give the interviewer an idea of how well you understand declarators. Either that or they were bored and just wanted to see if they could make your brain sieze.

    EDIT

    Most everyone else recommends using typedefs. The only time I recommend using a typedef is if the type is intended to be truly opaque (i.e., not manipulated directly by the programmer, but passed to an API, sort of like the FILE type). Otherwise, if the programmer is meant to manipulate objects of that type directly, then IME it’s better to have all that information available in the declaration, ugly as it may be. For example, something like

     NameFuncPickerPointer a[N];
    

    gives me no information on how to actually use a[i]. I don’t know that a[i] is callable, or what it returns, or what arguments it should take (if any), or much of anything else. I have to go looking for the typedef

    typedef char *NameFunc();
    typedef NameFunc *NameFuncPicker();
    typedef NameFuncPicker *NameFuncPickerPointer;
    

    and from that puzzle out how to write the expression that actually calls one of the functions. Whereas using the “naked”, non-typedef’d declaration, I know immediately that the structure of the call is

    char *theName = (*(*a[i])())();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got asked this question last interview and expect it again. The interview was
Got asked this interesting interview question today. Explain in detail the process by which
I was asked this interview question today!! (it was a really awkward telephonic interview..):
This was an interview question that someone asked me and I didn't really have
Hi I got this asked in an interview question paper. Singleton and Prototype (non-singleton)
This question was asked at interview. Say I have a contract. [ServiceContract] public interface
This was asked in my Google interview recently and I offered an answer which
This was the question asked in interview. Can we call one constructor from another
I was asked this in my interview today, I applied for a graduate developer
I was asked this question in a job interview, and I'd like to know

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.