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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:03:16+00:00 2026-05-15T20:03:16+00:00

The output of the following function is int *, which means the formal parameter

  • 0

The output of the following function is “int *”, which means the formal parameter is converted to a integer pointer. Is there any necessary reason for this design? Why can’t we reserve the array type?

// the output is "int *"
#include<typeinfo>
void Func(int ar[5])
{
  printf("%s\n", typeid(ar).name();
}
int main()
{
  int ar[5];
  Func(ar);
  return 0;
}
  • 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-15T20:03:17+00:00Added an answer on May 15, 2026 at 8:03 pm

    Is there any necessary reason for this design?

    This is historical baggage from C. Supposedly 1 this was convenience as you can’t pass arrays by-value anyway.

    If you want to preserve the type, you can use a references or pointers:

    void Func(int (&ar)[5]);
    

    Or using template functions to accept an arbitrarily sized array:

    template<std::size_t N> void Func(int (&ar)[N]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there any way of accomplishing something like the following: CREATE FUNCTION GetQtyFromID (
I tried the following: $.load(Views/chatBox.html).appendTo('body') Console Output: TypeError: $.load is not a function EDIT
I have the following output (via link) which displays the var_dump of some XML
why am I getting the following output: 4 8 12 16 20 int i,
I have a function pointer array which I use to call the appropriate cblas_xgemm
Consider the following program, which is obviously buggy: #include <cstdio> double test(int n) {
I'm using the following basic function which I copied from the net to read
Consider the following sample program in which a loop is running; int main() {
The following output appears after running some rake tasks: Loaded suite /usr/bin/rake Started Finished
Consider the following output from a Tomcat server under Eclipse: INFO: Initializing Coyote HTTP/1.1

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.