# <span class='text-muted'>042.</span> Zero-size array constructor

<span style='font-size: small;' class='text-muted'>topic: {ref}`arrays`</span>

`[data_type ::]` is a zero-size array of type `data_type`.
See examples below.

```{literalinclude} ../../src/zero-size.f90
:language: fortran
:caption: zero-size.f90 | <a href="https://github.com/zmoon/FortranTipBrowser/blob/main/src/zero-size.f90" target="_blank" title="See this source on GitHub"><i class="fab fa-github"></i></a> | <a href="https://github.com/Beliavsky/FortranTip/blob/main/zero_size.f90" target="_blank" title="See the original source on Beliavsky/FortranTip GitHub"><i class="fab fa-github"></i><sub>0</sub></a> | <a href="https://godbolt.org/#g:!((g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:fortran,selection:(endColumn:1,endLineNumber:18,positionColumn:1,positionLineNumber:18,selectionStartColumn:1,selectionStartLineNumber:18,startColumn:1,startLineNumber:18),source:'program+zero_size%0A+++implicit+none%0A%0A+++associate+(+%26%0A++++++r0+%3D%3E+%5Breal+::%5D,+%26%0A++++++d0+%3D%3E+%5Breal(kind(1.0d0))+::%5D,+%26%0A++++++i0+%3D%3E+%5Binteger+::%5D,+%26%0A++++++c20+%3D%3E+%5Bcharacter(len%3D2)+::%5D,+%26%0A++++++c50+%3D%3E+%5Bcharacter(len%3D5)+::%5D)%0A%0A+++print+*,+size(r0),+kind(r0)+++!!+0+4%0A+++print+*,+size(d0),+kind(d0)+++!!+0+8%0A+++print+*,+size(i0),+kind(i0)+++!!+0+4%0A+++print+*,+size(c20),+len(c20)++!!+0+2%0A+++print+*,+size(c50),+len(c50)++!!+0+5%0A%0A+++end+associate++!!+Required%0Aend+program+zero_size%0A'),l:'5',n:'0',o:'Fortran+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:gfortran112,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:fortran,libs:!(),options:'',selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1,tree:'1'),l:'5',n:'0',o:'x86-64+gfortran+11.2+(Fortran,+Editor+%231,+Compiler+%231)',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',m:62.300683371298405,n:'0',o:'',t:'0'),(g:!((h:output,i:(compiler:1,editor:1,fontScale:14,fontUsePx:'0',tree:'1',wrap:'1'),l:'5',n:'0',o:'Output+of+x86-64+gfortran+11.2+(Compiler+%231)',t:'0')),header:(),l:'4',m:37.699316628701595,n:'0',o:'',s:0,t:'0')),l:'3',n:'0',o:'',t:'0')),version:4" target="_blank" title="Open in Godbolt Compiler Explorer"><img src="https://raw.githubusercontent.com/compiler-explorer/compiler-explorer/main/views/resources/site-logo.svg" alt="Godbolt Compiler Explorer logo" width="55.11" height="16.7" class="align-text-bottom" /></a> | <a href="https://play.fortran-lang.org/?code=program%20zero_size%0A%20%20%20implicit%20none%0A%0A%20%20%20associate%20%28%20%26%0A%20%20%20%20%20%20r0%20%3D%3E%20%5Breal%20%3A%3A%5D%2C%20%26%0A%20%20%20%20%20%20d0%20%3D%3E%20%5Breal%28kind%281.0d0%29%29%20%3A%3A%5D%2C%20%26%0A%20%20%20%20%20%20i0%20%3D%3E%20%5Binteger%20%3A%3A%5D%2C%20%26%0A%20%20%20%20%20%20c20%20%3D%3E%20%5Bcharacter%28len%3D2%29%20%3A%3A%5D%2C%20%26%0A%20%20%20%20%20%20c50%20%3D%3E%20%5Bcharacter%28len%3D5%29%20%3A%3A%5D%29%0A%0A%20%20%20print%20%2A%2C%20size%28r0%29%2C%20kind%28r0%29%20%20%20%21%200%204%0A%20%20%20print%20%2A%2C%20size%28d0%29%2C%20kind%28d0%29%20%20%20%21%200%208%0A%20%20%20print%20%2A%2C%20size%28i0%29%2C%20kind%28i0%29%20%20%20%21%200%204%0A%20%20%20print%20%2A%2C%20size%28c20%29%2C%20len%28c20%29%20%20%21%200%202%0A%20%20%20print%20%2A%2C%20size%28c50%29%2C%20len%28c50%29%20%20%21%200%205%0A%0A%20%20%20end%20associate%20%20%21%20Required%0Aend%20program%20zero_size%0A" target="_blank" title="Open in Fortran Playground"><img src="https://raw.githubusercontent.com/fortran-lang/playground/main/frontend/src/fortran-logo.png" alt="Fortran logo" height="15.5" class="align-text-bottom" /></a>
```

```{code-block} text
:caption: Output[^gfortran-version]

           0           4
           0           8
           0           4
           0           2
           0           5

```

[^gfortran-version]: Compiled using `GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0` with no flags

From the Tweet comments, one potential use for this is that
"if a procedure has a required argument that is an integer array,
you can pass `[integer ::]` from the caller."

```{note}
The `associate` construct, used here,
"yields simple abbreviations for more complex statements.
It can be an alias for expressions or variables."[^a]
```

[^a]: <https://fortranwiki.org/fortran/show/associate>

---

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">[data_type :: ] is a zero-size array of type data_type.<a href="https://t.co/XmBx5W4ZBG">pic.twitter.com/XmBx5W4ZBG</a></p>&mdash; FortranTip (@fortrantip) <a href="https://twitter.com/fortrantip/status/1473848675566858242?ref_src=twsrc%5Etfw">December 23, 2021</a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>