简体   繁体   中英

"sh: fork: retry: no child processes" issue in C

So this is my C program which will take in 3 user inputted numbers and output the sum. However, I have a problem regarding this when it was compiled:

sh: fork: retry: no child processes.

I'm a beginner in the C language, only used C#, what is the problem with my code? I used codinground.com to compile and execute by the way

#include <stdio.h>

int main() 
{
    int a,b,c;

    int sum;

    printf("Enter the first integer\n");
    scanf("%d%*c", &a);

    printf("Enter the second integer\n");
    scanf("%d%*c", &b);

    printf("Enter the third integer\n");
    scanf("%d%*c", &c);

    sum = a + b + c;
    printf("The sum of those numbers is: %d\n",sum);
    return 0;
}

The machine where you are compiling might be running low on resources Try stopping some processes to get some memory freed and then try compilation again

The message

sh: fork: retry: no child processes.

is emitted by the shell , sh . This almost surely indicates that an attempt is being made to execute your C source code as a shell script or other interpreted script. Your code is not a valid shell script, and it has no interpreter line (nor is there likely to be a viable interpreter anyway; see below), so this fails.

In principle, C source code could be run in an interpreter, like a script. In practice, it is almost always compiled to a binary executable, and the executable then run. Though the details vary, this is not inherently different from the C# case with which you are familiar.

I have no idea what you did at condinground.com to try to make it compile and run your program. I don't even see anything plausible to try , and it's unclear what would make you think that site provides any such service. Ideally, you would get a C compiler that you can run locally, to produce an executable that you can also run locally -- there are good ones available for free. If you insist on an online service, however, then you could consider ideone .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM