This is Really Crazy! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

This is Really Crazy!

Why My Code Doesn't Work!? Please Help https://code.sololearn.com/cDlhqQlZ91ZS/?ref=app

31st Mar 2018, 7:57 PM
H. Ahmadian
H. Ahmadian - avatar
13 Answers
+ 3
But I have rewrite code from scratch @Alex, and removed function prototype. Is this type of error specific to C!?
31st Mar 2018, 8:18 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
I am using Xiaomi redmi note 4x with Default English Keyboard.
31st Mar 2018, 8:23 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
SwiftKey keyboard @Alex, according to phone settings.
31st Mar 2018, 8:25 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
I have changed keyboard to Gboard English US and made some edits to code but still same error!
31st Mar 2018, 8:33 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
// To Dear Friend @Alex! #include <stdio.h> #include <string.h> void Execute (char*); int main(int argc , char* argv[]) { char command[10]; printf("\n Enter Command Via CommandLine! \n \n"); if(argc < 2) printf("\n ERROR, Not sufficient arguments!"); else Execute(argv[1]); printf("\n \n \n COMMAND ---> "); scanf("%s" , command); Execute (command); } void Execute (char* command) { if(!strcmp(command , "Help")) printf("\n HELP!!!"); else printf(" \n <%s>: Command Not Found" , command); }
31st Mar 2018, 9:11 PM
H. Ahmadian
H. Ahmadian - avatar
+ 3
Thanks @M N But why that happened!? How spaces can be invalid characters!? It's because of Keyboard or something
31st Mar 2018, 9:14 PM
H. Ahmadian
H. Ahmadian - avatar
+ 2
Can you write some lines of code for me so I can cut them and test the spaces? I want to check where this happens.
31st Mar 2018, 8:35 PM
Alex
Alex - avatar
31st Mar 2018, 8:10 PM
Alex
Alex - avatar
+ 1
No the bug comes from your device. What keyboard are you using? Maybe use another language setting or another keyboard.
31st Mar 2018, 8:21 PM
Alex
Alex - avatar
+ 1
I tested around a bit and not all of your spaces are encoded wrong. Hard to tell what's the exact problem. But we know the reason. Have you tried another keyboard?
31st Mar 2018, 8:32 PM
Alex
Alex - avatar
+ 1
I checked the code and detected that spaces at the start of lines are invalid chars, so removed them and using tab button of the code playground added them again. the code works now: https://code.sololearn.com/cv5iDY81cgF8/?ref=app
31st Mar 2018, 8:43 PM
🇮🇷 M N
+ 1
only the spaces at the begining of lines was invalid, other spaces were valid i think that you use tab key of your keyboard at the start of lines and it has problem, try a very simple code with a line, and test with the tab key of your keyboard and tab key of code playground
31st Mar 2018, 9:20 PM
🇮🇷 M N