+ 1
What does ":" mean?? Or what does it do
Arrays in loop
4 Antworten
+ 6
Its usally used inside an enhanced for loop it is usually read as "in".
Edit: Just found this which might help i actually learned somthing too here thanks ☺..
https://stackoverflow.com/questions/2399590/what-does-the-colon-operator-do
+ 2
Where did you see this? Can you give an example?
Edit:
Do you mean the last code example in this lesson?
https://www.sololearn.com/learn/CPlusPlus/1627/?ref=app
+ 2
Williams Nengi
" " <-- String
A String can be everything. "Hello", "123", "+"
If you look in the code: The Author of this code want to print x and myArr[x]. The intention of printing : is to look it better or to separate x from myArr[x].
Play around with the code and see what happens when you remove ":" or when you insert "-". (Tap "try it yourself")
0
Int myArr[5];
For(int x=0;x<5;x++) {
MyArr[x] =42;
Cout<<x<<":"<<myArr[x] <<endl;