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 132 views
1 answer 128 views
128 views asked May 18, 2025 by avibootz
1 answer 159 views
159 views asked May 19, 2025 by avibootz
1 answer 149 views
149 views asked May 19, 2025 by avibootz
1 answer 220 views
220 views asked May 19, 2025 by avibootz
1 answer 150 views
150 views asked May 19, 2025 by avibootz
...