Please why am I getting an error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please why am I getting an error

Looping through an Array in C..I am getting an error https://code.sololearn.com/c5FX6Cc7uczd/?ref=app

6th Jul 2022, 8:20 AM
steve Purpose
steve  Purpose - avatar
13 Answers
+ 2
Steve, Code is logically fine. The problem here is the code contains invalid characters that are unacceptable by the compiler. Those invalid characters got accidentally copied, usually from web pages. If you have an encoding option in your code editor then try to set it to ANSI or ISO-8859-15 encoding. There you will see them.
6th Jul 2022, 8:31 AM
Ipang
+ 2
Steve, This may not seem all too different to your original code, but the invalid characters had been removed #include <stdio.h> int main() { int myNumbers[] = { 25, 50, 75, 100 }; int i; for(i = 0; i < 4; i++) { printf("%d\n", myNumbers[i]); } } Here's how it looks in my phone, edited in QuickEdit https://www.sololearn.com/post/1702671/?ref=app
6th Jul 2022, 8:49 AM
Ipang
+ 1
Ipang probably there's an error on the web page..Thanks I'll edit it by typing out manually now
6th Jul 2022, 8:52 AM
steve Purpose
steve  Purpose - avatar
0
paste the code and answer here. I can't access that link
6th Jul 2022, 8:22 AM
Timm0x443
Timm0x443 - avatar
0
#include <stdio.h> int main() { int myNumbers[] = {25, 50, 75, 100}; int i; for (i = 0; i < 4; i++) {   printf("%d\n", myNumbers[i]); } }
6th Jul 2022, 8:23 AM
steve Purpose
steve  Purpose - avatar
0
The code seems okay. What error are you getting? what was the question again?
6th Jul 2022, 8:27 AM
Timm0x443
Timm0x443 - avatar
0
Run in to see what you get
6th Jul 2022, 8:28 AM
steve Purpose
steve  Purpose - avatar
0
I got none of those..can you paste the ANSI and let me c..I used replit code editor and sololearn playground
6th Jul 2022, 8:33 AM
steve Purpose
steve  Purpose - avatar
0
Steve, Can you open this code in browser (SoloLearn web interface)? there it also shows the invalid characters ...
6th Jul 2022, 8:36 AM
Ipang
0
Can you please paste it here
6th Jul 2022, 8:37 AM
steve Purpose
steve  Purpose - avatar
0
Ipang for some reason I can't access the web interface code playground
6th Jul 2022, 8:41 AM
steve Purpose
steve  Purpose - avatar
0
Steve, You mean you can't access my feed post link? feed post links are only accessible via SoloLearn mobile app ...
6th Jul 2022, 8:54 AM
Ipang
0
Ok corrected ✌️
6th Jul 2022, 9:01 AM
steve Purpose
steve  Purpose - avatar