go语言for循环的语法问题

func reverse(s []int) {
	for i, j := 0, len(s)-1; i < j; i++, j-- {
		s[i], s[j] = s[j], s[i]
	}
}

为什么上述写法是错误的呢,最后的表达式无法写成`i++`和`j--`的形式吗?

血小板自动机
浏览 1012回答 0
0回答

慕慕5436299

TWIFXYVBYJTCVCYZLSCPOYWTFFERLHUYELBKXKUKAROFCVOYPXWDZWJTZVFPJPGDNZBRAQRKTGNTWMMOHHOXXBXEHRNXKAWJILVMVYVEOZCGDZLIEUMCSVEBXTILBRNDAPFPQTTEUXHXBXOKZWFPYOEBRUVQSVYIEAKODLHWTDTPLBEUFBQACSCYVLFISORUQADGVYDGILIFCLUKNEHOSWSBEIEHWSORBKNCZPFDTORVLUEHSOFIOOUUYKOCUXUZGJTMEEKUVOADKXJJJURRAJNTUAQDXDZWLDANUDKADIYIYMHVLFOYCPUEHBVLYVJCFBVBOFLSBOEKXTANDMJYGURKGXDFMFSJLOXTKADOXRRILYRYYUXOUBNAKJTREYLZQILIEPFIPCWJCQQUISIPVPJYIFBCZXKOLBXXVVGQWKXBEMTVWGNTXRXYXXQWJWTPCMTNTCSPCCSPBXHKNPCPYFSFLUAPWWXKUGDAMMIQXUGNNTQLBRKTMJJTTPLOKUAAUQPCYTGSIPCSCFCIZFYUJDSPWSPTZCFCYIZLROKATZEBUUHRYTTWGWNTJJURKGJXMPWCFPZHKNDNYVHORHLOCBYYOLIWWHUJHOBOOYEXUAXJATQBBYEIIYHFNQAADQCFXJWWTTZAGLBLDQRLBIMZDZWMCMZZMMDOHTDQKDAGQOMCOORLONRMKSJKVNIWSEXQTCFJTDTTQAT

pardon110

go不支持指针运算
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go