[英]Error assignment of read-only location '__result.std::_Rb_tree_const_iterator<_Tp>::operator*<long long int>()'
[英]C++ [Error] assignment of read-only location '*(a + ((sizetype)(((long long unsigned int)min) * 4ull)))'
我试图写一些打印代码,但是总是有两个错误。 我的老师真的很糟糕,他没有教我们如何更改const类型的上下文或地址。 我真的需要帮助,非常感谢。
有我的代码,放置了一个数组,然后对其进行排序,但是当我尝试交换a [min]和a [i]时,发现我错了。 如何解决?
[Error] assignment of read-only location
该错误表示您正在尝试写入只读位置,或者在您的情况下尝试更改常量。
更改为
void print_array(const int a[], const int asize)
至
void print_array(int a[], const int asize)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.