C language programs stop and continue to run

Updated on technology 2024-03-31
3 answers
  1. Anonymous users2024-02-07

    The reason why the exe stops working when the C program runs is because of a memory overflow and a compiler error.

    Type 1: Memory overflow.

    Out of memory is commonly understood as insufficient memory, and the memory required by the program far exceeds the size of the memory installed in the host, which is called memory overflow. The system will prompt a memory overflow, sometimes the software will be automatically closed, and the software can run normally after restarting the computer or releasing a part of the memory after the software.

    Second: compiler errors.

    Some compilers may use different standards (for example, the C99 standard may be used on one machine, and the C11 standard may be used on another machine), or because the compiler link library is damaged, in a few cases, it may also cause the program to have abnormal errors that are not limited to crashes and exits, and the solution is usually to install the latest version of the compiler's official IDE.

    Examples: 1. Divide by zero.

    2. Array out-of-bounds: int a[3]; a[10000000]=10。

    3. The pointer is out of bounds: int * p; p=(int *)malloc(5 * sizeof(int));p+1000000)=10。

    4. Use the space that has been released: int * p; p=(int *)malloc(5 * sizeof(int));free(p); p=10。

    5. The array is too large and beyond the scope of the stack, causing the stack to overflow: int a[100000000], and the memory is not opened up list l=(list)malloc(sizeof(struct lnode)). Runtime error is when a program crashes halfway through running.

  2. Anonymous users2024-02-06

    You can refer to the following.

    BAI**:

    #include

    #include

    #include

    main( )

    return 0;

    Expand the capital

    Material: zhi

    KBHIT() is a C and C++ function that DAO is used to respond to keyboard input events in a non-blocking manner. Answer.

    Function name: kbhit().

    Function and return value: Check whether there is currently a keyboard input, if there is, return a non-0 value, otherwise return 0.

    Usage: int kbhit(void);

    The C++ language contains header files: include.

    The C language does not need to contain additional header files.

    kbhit() under vc++

    The function and return value are the same as above.

  3. Anonymous users2024-02-05

    with baikbhit function.

    Below**, e.g. du

    If there is no zhi keyboard input program a dao

    Straight output hello world until the user.

    Exclusively according to the end of the ESC.

    #include

    #include

    intmain(void)

    printf("end!");

    system("pause");

    return0;}

Related questions
8 answers2024-03-31

If the landlord is looking for the textbook for the class, it is not helping the landlord, the book is not good, and no one has to do the electronic version. >>>More

5 answers2024-03-31

Define an array of scores to record scores, record rankings and score bins. >>>More

14 answers2024-03-31

First question: What does exit failure mean? Why do you need this thing in this program? >>>More

9 answers2024-03-31

Their instruction sets, with different addressing methods, are equivalent to two machines operating in their own ways. >>>More

8 answers2024-03-31

The C language program written according to the requirements of the topic is as follows. >>>More