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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:45:22+00:00 2026-06-12T03:45:22+00:00

I learned that: char ar[] is the same of char *ar These three expressions:

  • 0

I learned that:

char ar[] 

is the same of

char *ar

These three expressions:

char ar[][] //1
char *ar[] //2
char **ar //3

are the same thing for the compiler?

These two expressions:

char ar[]
char ar[][]

will allocate the array on the stack, while all the others will allocate it on the heap?

  • 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-06-12T03:45:23+00:00Added an answer on June 12, 2026 at 3:45 am

    char ar[] is only the same as char *ar when ar is a function parameter. Otherwise they are an array and a pointer respectively.

    char ar[][] is a 2-d array if ar is not a function parameter. Otherwise it’s a pointer to a 1-d array.

    char *ar[] is a 1-d array of pointers if ar is not a function parameter. Otherwise it’s a pointer to a pointer.

    char **ar is a pointer to a pointer.

    Basically, if it’s a function parameter and it looks like it’s an array, it’s actually a pointer to the array’s first element. Arrays aren’t passed in their entirety as function parameters. When you try to, you will pass pointers to first elements of the arrays, and not arrays themselves.

    All variables defined outside of functions aren’t neither in the heap nor on the stack. They are global variables.

    All variables defined inside of functions (with the exception of static variables) are on the stack. static variables are global-ish, they aren’t neither in the heap nor on the stack. static reduces the visibility of a global variable to the function or module scope, only that.

    Only those variables allocated explicitly via malloc(), calloc(), ralloc() live in the heap. Some standard library functions may create variables/objects in the heap, e.g. fopen().

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

Sidebar

Related Questions

I learned that compiler will expand macros while compiling. Templates are also expanded at
I recently learned that all stl containers have swap function: i.e. c1.swap(c2); will lead
I learned that if I compile main.cpp the compiler simply replaces all includes with
While reading the answers to this SO question , I learned that out-of-bounds pointer
I learned that when executing commands in Python, I should use subprocess. What I'm
I learned that repaint() wasn't an actual method that repaints the screen. Rather, it
I learned that Xcode can compile c code, that means can we write whole
I recently learned that table valued functions are not allowed with Entity Framework 4.1.
I've learned that MySQL can compress communication between servers and clients. Compression is used
I googled around and learned that Lift encourages view-first development, lazy loading of entities,

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.