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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:37:01+00:00 2026-06-08T11:37:01+00:00

I know that arrays in C are just pointers to sequentially stored data. But

  • 0

I know that arrays in C are just pointers to sequentially stored data. But what differences imply the difference in notation [] and *. I mean in ALL possible usage context.
For example:

char c[] = "test";

if you provide this instruction in a function body it will allocate the string on a stack while

char* c = "test";

will point to a data (readonly) segment.

Can you list all the differences between these two notations in ALL usage contexts to form a clear general view.

  • 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-08T11:37:02+00:00Added an answer on June 8, 2026 at 11:37 am

    According to the C99 standard:

    An array type describes a contiguously allocated nonempty set of
    objects with a particular member object type, called the element
    type.

    1. Array types are characterized by their element type and by
      the number of elements in the array. An array type is said to be
      derived from its element type, and if its element type is T, the array
      type is sometimes called array of T. The construction of an array
      type from an element type is called array type derivation.

    A pointer type may be derived from a function type, an object type, or
    an incomplete type, called the referenced type. A pointer type
    describes an object whose value provides a reference to an entity of
    the referenced type. A pointer type derived from the referenced type T
    is sometimes referred to as a pointer to T. The construction of a pointer
    type from a referenced type is called pointer type derivation.

    According to the standard declarations

    char s[] = "abc", t[3] = "abc";
    char s[] = { 'a', 'b', 'c', '\0' }, t[] = { 'a', 'b', 'c' };
    

    are identical. The contents of the arrays are modifiable. On the other hand, the declaration

    const char *p = "abc";
    

    defines p with the type as pointer to constant char and initializes it to point to an object with type constant array of char (in C++) with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to modify the contents of the array, the behavior is undefined.

    According to 6.3.2.1 Array subscripting dereferencing and array subscripting are identical:

    The definition of the subscript operator [] is that E1[E2] is
    identical to (*((E1)+(E2))).

    The differences of arrays and pointers are:

    • pointer has no information of the memory size behind it (there is no portable way to get it)
    • an array of incomplete type cannot be constructed
    • a pointer type may be derived from an incomplete type
    • a pointer can define a recursive structure (this one is the consequence of the previous two)

    More helpful information on the subject can be found at http://www.cplusplus.com/forum/articles/9/

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

Sidebar

Related Questions

I know .net supports base64 encoding of byte arrays. But i thought that i
Yes I know Ruby doesn't have pointers, but that's the closest I could get
I just want to know how to access an array in SMARTY that have
I know that 2d arrays are arrays of arrays. To get a row you
So we all know that when iterating through a PHP array using foreach, the
How in C++ get array length with pointers only ? I know that tab
My apologies, I know there are a million questions on pointers, arrays etc. although
I have an array of pointers that point to arrays of ints. I have
When working with arrays and pointers in C, one quickly discovers that they are
I'm just starting out with pointers, and I'm slightly confused. I know & means

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.