0
Why am I getting garbage output for about 30 iterations with this simple for loop?
Garbage is mostly at the start, but there is also some at the end. Here is my code. Any help is appreciated. #include<iostream> using namespace std; //for loop to display ASCII characters. int main() { for (int i = 0; i < 128; i++) { char ASCII = i; cout << ASCII << " "; if (i % 16 == 0) { //enters newline every 16 iterations cout << endl; } } return 0;
3 Answers
+ 5
They're not garbage, they're just special characters. You can look at this: http://www.ascii-code.com/, look at the Symbol column to see which character corresponds to the char code.
+ 2
You're welcome!
0
Awesome, thanks a lot!