Skip to main content
added 5 characters in body
Source Link
Timwi
  • 4.5k
  • 32
  • 37

Array declarations in C and C++.

Array declarations in C and C++. TypicallyTypically, a variable declaration is of the format type variable_name. You can easily read those declarations in a left-to-right manner. But int foo[size] looks at first like it's declaring foo as an int, and then you read further and see that foo's of type "array of integers." int[size] foo reads much better.

And I also hate it when programmers declare pointers like this for a similar reason: int *foo. For some reason I haven't figured out, that's the typical way it's written.

Array declarations in C and C++. Typically, a variable declaration is of the format type variable_name. You can easily read those declarations in a left-to-right manner. But int foo[size] looks at first like it's declaring foo as an int, and then you read further and see that foo's of type "array of integers." int[size] foo reads much better.

And I also hate it when programmers declare pointers like this for a similar reason: int *foo. For some reason I haven't figured out, that's the typical way it's written.

Array declarations in C and C++.

Typically, a variable declaration is of the format type variable_name. You can easily read those declarations in a left-to-right manner. But int foo[size] looks at first like it's declaring foo as an int, and then you read further and see that foo's of type "array of integers." int[size] foo reads much better.

And I also hate it when programmers declare pointers like this for a similar reason: int *foo. For some reason I haven't figured out, that's the typical way it's written.

Post Made Community Wiki
Source Link
Jacob
  • 382
  • 3
  • 15

Array declarations in C and C++. Typically, a variable declaration is of the format type variable_name. You can easily read those declarations in a left-to-right manner. But int foo[size] looks at first like it's declaring foo as an int, and then you read further and see that foo's of type "array of integers." int[size] foo reads much better.

And I also hate it when programmers declare pointers like this for a similar reason: int *foo. For some reason I haven't figured out, that's the typical way it's written.