本文介绍了关于二维数组和strchr中的指针的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 四个字符串位于二维数组中;使用strchr分别找到字符a,b,c; 将搜索结果放入另一个2-D arrray ter [] []: 搜索结果第一个字符串中的'a''转到ter [0] [0],'b''到ter [0] [1] ... ...第二个字符串到ter [1] [0],'b''到ter [1] [1] ... ... 这里是代码: ... four strings are in a 2-D array; use strchr to find characters a, b, c, respectively;search results are to be put in another 2-D arrray ter[ ][ ]:results of searching ''a'' in the 1st string go to ter[0][0], ''b'' to ter[0][1]...... 2nd string to to ter [1][0], ''b'' to ter[1][1]......here are the codes:... 展开 | 选择 | Wrap | 行号 推荐答案 展开 | 选择 | Wrap | 行号 不要因为我不是常数而得到错误?(你的代码中的粗线) 现在到了这一点: 因为这个代码不存在两个尺寸阵列: char ter [i] [3]和char ter [3 * i]相同,所以想想这个.. Savage Don''t u get error because i is not constant?(Bolded lines in ur code) Now to the point: Because two dimensinal arrays doesn''t really exist this code: char ter[i][3] is same as char ter[3*i],so think about this.. Savage 这可能适用于某些编译器。 C99标准允许它,而另一些标准则将其作为扩展。但是,我没有初始化,所以仍然会出现警告。此外,不要使用粗体,它不会很好地显示这种字体。 至于OP的原始问题。你想要第10行做什么? Adrian This may work on some compilers. The C99 standard allows for it, and some others have it as an extention. However, i is not initialised so a warning should still show up. Also, don''t use bold, it doesn''t show up very well with this font. As for the OP''s original question. What do you want line 10 to do? Adrian 。 ..不要用粗体,它不会很好地显示 Adrian ...don''t use bold, it doesn''t show up very well Adrian 好的,谢谢。 Savage OK,thanks. Savage 这篇关于关于二维数组和strchr中的指针的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 11:00