LoginSignup
0
1

More than 5 years have passed since last update.

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

Last updated at Posted at 2016-12-18
動作環境
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

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

0
1
9

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1