Hello! So I'm working on a little personal project. I have been coding in C for around a month and a half, but this is not my first language so I am not a complet beginner in programing.
So onto my little problem. I made a small example of the problem.
I'm using Dev-C++ 4.9.9.2 and I get error messages:Code:#include <stdio.h> #include <string.h> int keep_running = 1; //To keep loops running //Function Decl void list(); void help(); int main() { //Decl char input[81]; while( keep_running == 1) //Main Screen { printf("root@chips:~# "); gets(input); switch(input) { case 'ls' : list(); break; case 'help' : help(); break; default : printf("Unknown Command"); break; } } //while end } //Main end void list() { printf("FILES LISTED\n"); } void help() { printf("HELP STUFF"); }
C:\Users\*\Documents\C Projects\main.cpp In function `int main()':
24 C:\Users\*\Documents\*\main.cpp switch quantity not an integer
26:11 C:\Users\*\Documents\*\main.cpp [Warning] multi-character character constant
29:11 C:\Users\*\Documents\*\main.cpp [Warning] multi-character character constant
Not sure if I should of wrote strcmp (input, "ls") != 1 insted of just 'ls'
Have I done something wrong? I tried using a if else statement but that did not go to well.