I don't know what the use of exit() is
Consider the two following codes:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *ptr;
if ((ptr = malloc(sizeof(int))) == NULL) {
printf("Error");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *ptr;
if ((ptr = malloc(sizeof(int))) == NULL) {
printf("Error");
return 1;
}
return 0;
}
What are the differences between the two of them ?