Compiler error: invalid conversion from 'int' to 'int*' [-fpermissive]|

前端 未结 4 1480
萌比男神i
萌比男神i 2021-01-15 02:20

I got a compiler error:

main.cpp|59|error: invalid conversion from \'int\' to \'int*\' [-fpermissive]|

The offending line is

4条回答
  •  时光取名叫无心
    2021-01-15 03:06

    You forgot &. vector[nElementos-1] is the value, while you need an address for pFinal.

    Either *pFinal = &(vector[nElementos-1]) or *pFinal = vector + nElementos-1.

提交回复
热议问题