invalid conversion from 'char*' to 'char'

后端 未结 2 677
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-26 10:56

I\'m getting the error in the title. It\'s pointing to the line where the for-loop is declared. Any ideas on what is happening?

#include 

templa         


        
2条回答
  •  鱼传尺愫
    2021-01-26 11:25

    That's a common error with multiple comma separated pointer variable declarations. Change your for loop header as follows:

    for (T *i(arr+1), *j(arr+n); i != j; ++i) {
                   // ^ Note the additional asterisk!
    }
    

    See the fixed and working sample here.

提交回复
热议问题