Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

C > 配列の先頭アドレスの取得 > &array[0] / &array

動作環境
C89の組込み環境

配列の先頭アドレスの取得は僕は&array[0]を使っている。
人のコードを読んでいた時に、&arrayとしていたので、両者が同じか確認してみた。

#include <stdio.h>

int main(void) {
    int array[5] = { 3, 1, 4, 1, 5 };

    printf("%p\n", &array[0]);
    printf("%p\n", &array);

    return 0;
}
結果
Success time: 0 memory: 2168 signal:0
0xfff6e87c
0xfff6e87c

一応、両者ともに同じアドレスになっている。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
1
Help us understand the problem. What are the problem?