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 473097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:09:09+00:00 2026-05-13T00:09:09+00:00

What is the type of &a in the following code? char a[100]; myfunc(&a) Is

  • 0

What is the type of &a in the following code?

char a[100];
myfunc(&a)

Is this even valid code? gcc -Wall complains about missing prototype but will otherwise generate code as if myfunc(a) was written.

  • 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-13T00:09:09+00:00Added an answer on May 13, 2026 at 12:09 am

    The type of &a in that code is char (*)[100], which means “pointer to array of 100 chars”.

    To correctly prototype myfunc to take that argument, you would do it like so:

    void myfunc(char (*pa)[100]);
    

    or the completely equivalent:

    void myfunc(char pa[][100]);
    

    Addendum:

    In answer to the additional question in the comments:

    1. Yes, you would use (*pa)[0] or pa[0][0] within myfunc to access the first element of the array.

    2. No, &a (and thus pa) contain the address of the array. They do not contain the address-of-an-address. It should be obvious that the address of an array and the address of its first element are the same – the only difference is the type. Thus (void *)&a == (void *)a is true, and (void *)pa == (void *)pa[0] is also true, even if this seems a little unintuitive.

    Consider these two declarations:

    char (*pa)[100];
    char **ppc;
    

    Now, even though pa[0][0] and ppc[0][0] are both of type char, the types of pa and ppc are not equivalent. In the first case, the intermediate expression pa[0] has type char [100], which then evaluates to a pointer to the first element in that array, of type char *. In the second case, the intermediate expression ppc[0] is already a char *.

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

Sidebar

Related Questions

Consider the following methods static ComponentType & getTypeFor(const type_info &t){ ComponentType * type =
For strongly-typed & type-safe solution, I have to do the following step. Create some
I have been trying to access the below code DECLARE N_DEPTNO DEPT.DEPTNO %TYPE :=&DEPT_NUM;
I have the following piece of code. This is written for getting the list
The following code sample writes a structure variable of type EMPLOYEE to a file
I have the following code in my file: unsigned char * pData = new
I copied the following C code from K&R. The code is supposed to print
Can you please explain the error from following code please: void foo(void*& param) {
I have an issue with the following code. int main (int argc, const char
I have the following code: boost::filesystem::path p = boost::filesystem::current_path(); But I get this error

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.