Search code examples
c++cprogram-entry-pointresource-fileskali-linux

How can I solve this error in c language in kali system?


I put the code in a source file and give it permission to execute then when I run this file, the output appears in the picture what does that mean? How can I solve it?

Output

#include <stdio.h>
//unsigned long balance; 
//float deposit; 
//int choice, pin, k,withdraw;
//char name[20];

int main() {
    char name[20];

    printf("Enter your first and last name");
    scanf("%s", name);
    for (int i = 0; name[i] != '\0'; ++i) {
        if (!(name[i] >= 'a' && name[i] <= 'z') || (name[i] >= 'A' && name[i] <= 'Z')) {
            printf("The entered name is not all  Alphabet char plz insert a valid name");
            break;
        }
    }
}

Solution

  • You can't run a .c file like it's a script. You need to compile it first:

    gcc -o main main.c
    ./main