I am new to C and I am trying to learn, so go easy on me :D
I am currently trying to make a simple bank account console application. I got the following code:
#include <stdio.h>
#include <string.h>
void parseCommand(char cmd[15], bool end) {
    if(cmd != NULL) {
        if(strstr(cmd, "listaccounts") != NULL) {
        } else if(strstr(cmd, "addaccount") != NULL) {
        } else if(strstr(cmd, "removeaccount") != NULL) {
        } else if(strstr(cmd, "withdraw") != NULL) {
        } else if(strstr(cmd, "deposit") != NULL) {
        } else if (strstr(cmd, "exit") != NULL) {
            end = true;
        } else {
            printf("Unknown Command: %s\n", cmd);
        }
    } else {
        printf("cmd is null");
    }
}
int main() {
    printf("Welcome to the Account Management System\n");
    printf("Please use one of the following commands:\n");
    bool end = false;
    while(true) {
        printf("\tlistaccounts\n");
        printf("\taddaccount\n");
        printf("\tremoveaccount\n");
        printf("\twithdraw\n");
        printf("\tdeposit\n");
        printf("\texit\n");
        char cmd[15];
        fgets(cmd,15,stdin);
        parseCommand(cmd, end);
        if(end == true) {
            printf("Shutting down...");
            break;
        }
    }
    return 0;
}
But when I type "exit" the program just starts over in the while loop and asks for new input. What am I doing wrong? My guess would be how I try to compare two strings.
 
     
     
     
     
    