How to stop a program in C

3 Answers

0 votes
#include <stdio.h>

int main() {
    printf("abc");
    
    return 0;
    
    printf("xyz");

    return 0;
}


/*
run:

abc

*/

 



answered May 18, 2025 by avibootz
0 votes
#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("abc");
    
    exit(EXIT_SUCCESS);

    printf("xyz");

    return 0;
}


/*
run:

abc

*/

 



answered May 18, 2025 by avibootz
0 votes
#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("abc");
    
    abort();

    printf("xyz");

    return 0;
}


/*
run:

Aborted

*/

 



answered May 18, 2025 by avibootz

Related questions

1 answer 216 views
1 answer 244 views
244 views asked May 18, 2025 by avibootz
1 answer 282 views
282 views asked May 19, 2025 by avibootz
1 answer 240 views
240 views asked May 19, 2025 by avibootz
1 answer 323 views
323 views asked May 19, 2025 by avibootz
1 answer 254 views
254 views asked May 19, 2025 by avibootz
...