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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:08:20+00:00 2026-05-21T03:08:20+00:00

When you create the multi-dimensional array char a[10][10] , according to my book it

  • 0

When you create the multi-dimensional array char a[10][10], according to my book it says you must use a parameter similar to char a[][10] to pass the array to a function.

Why must you specify the length as such? Aren’t you just passing a double pointer to being with, and doesn’t that double pointer already point to allocated memory? So why couldn’t the parameter be char **a? Are you reallocating any new memory by supplying the second 10.

  • 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-21T03:08:21+00:00Added an answer on May 21, 2026 at 3:08 am

    Pointers are not arrays

    A dereferenced char ** is an object of type char *.

    A dereferenced char (*)[10] is an object of type char [10].

    Arrays are not pointers

    See the c-faq entry about this very subject.


    Assume you have

    char **pp;
    char (*pa)[10];
    

    and, for the sake of argument, both point to the same place: 0x420000.

    pp == 0x420000; /* true */
    (pp + 1) == 0x420000 + sizeof(char*); /* true */
    
    pa == 0x420000; /* true */
    (pa + 1) == 0x420000 + sizeof(char[10]); /* true */
    
    (pp + 1) != (pa + 1) /* true (very very likely true) */
    

    and this is why the argument cannot be of type char**. Also char** and char (*)[10] are not compatible types, so the types of arguments (the decayed array) must match the parameters (the type in the function prototype)

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

Sidebar

Related Questions

I need to create a function that has a parameter which is a multi-dimensional
I'd like to pass a multi-dimensional array to a constructor like so: constructor TMyClass.Create(MyParameter:
I need to create a multi-dimensional array in php and want to use it
I am trying to create a multi-dimensional array whose parts are determined by a
I would like to create a multi-dimensional array with two variables but don't know
I want PHP to randomly create a multi-dimensional array by picking a vast amount
I need to create a multi-dimensional array which will be passed to a class.
I have a JSON file that I would like to create an multi-dimensional array
This is a followup to Multi-dimensional char array (array of strings) in python ctypes
I spotted the following behavior. Say I create the following multi-dimensional array: spam =

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.