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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:21:21+00:00 2026-05-18T04:21:21+00:00

This might be a stupid question, but I have a little problem with understanding

  • 0

This might be a stupid question, but I have a little problem with understanding of C Pointers. Even more when it comes to arrays. For example:

char ptr[100];
ptr[0]=10;

fprintf(stderr, "&ptr: %p \n ptr: %p \n*ptr: %d\n", &ptr, ptr, *ptr);

if ( &ptr == ptr ) {
  fprintf(stderr, "Why?\n");
}

How is this even possible? ‘ptr’ is at the adress &ptr. And the content of ptr is the same as &ptr. Then why is *ptr = 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-18T04:21:21+00:00Added an answer on May 18, 2026 at 4:21 am

    The address of the first element of the array is the same as the address of the array itself.

    Except when it is the operand of the sizeof or address-of & operators, or is a string literal being used to initialize another array in a declaration, an expression of type “N-element array of T” will be implicitly converted (“decay”) to type “pointer to T” and the value will be the address of the first element in the array.

    If the expression a is of type “N-element array of T”, then the expression &a is type “pointer to N-element array of T”, or T (*)[N].

    Given the declaration

    T a[N];
    

    then the following are all true:

    Expression         Type        Decays to
    ----------         ----        ---------
             a         T [N]       T *
            &a         T (*)[N]    n/a
            *a         T           n/a
    

    The expressions a and &a both evaluate to the same value (the location of the first element in the array), but have different types (pointer to T and pointer to array of T, respectively).

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

Sidebar

Related Questions

This might be a stupid question but if there's a better or proper way
This might be a stupid question but I just wanted to make sure... If
This might be a stupid question, but I can't for the life of me
This might sound like a stupid question, but google didn't help me. Is there
This might seem like a stupid question I admit. But I'm in a small
This might sound like a little bit of a crazy question, but how can
This might be a stupid question but I'm new at all this. I want
This might be a stupid question but I'll ask anyway, I was reading OOP
This might be a stupid question, but is there any common practice for initializing
This might be on the discussy side, but I would really like to hear

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.