0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Arrayのサイズ非指定

Last updated at Posted at 2024-01-16

Arrayのサイズ非指定

sample.c
int main() {
  int a[] = { 1, 2, 3 };  

  char c = 'x';
  char *cptr = "xyz";       //equivalent to array[4] = {'x','y','z','\0'}

  char carr1[] = {'a','b'};
  char carr2[] = "text";    //equivalent to array[5] = {'t','e','x','t','\0'}
  char *captr[] = {"p","q"};//equivalent to *array[2] = {*{'p','\0'}, *{'q','\0'}}
}

image.png

まとめ

記号 役割 区切り
{} xxx(要素に準拠)[] カンマ区切り
"" char[] 文字区切り
'' char -
0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?