Difference between [square brackets] and *asterisk

后端 未结 5 2117
遇见更好的自我
遇见更好的自我 2020-11-27 04:03

If you write a C++ function like

void readEmStar( int *arrayOfInt )
{
}

vs a C++ function like:

void readEmSquare( int arrayOfInt[] )
{
}
         


        
5条回答
  •  囚心锁ツ
    2020-11-27 04:33

    On the style question I'll stick my neck out and say int *arrayOfInt is better. Which ever syntax you use you are passing a pointer and the type should make that clear.

    This is just my opinion.

提交回复
热议问题