C
Clunixchit
Im writing a program in which i have to perform several mallocs
in order to simply my code i have used
void e_malloc(){
perror("malloc");
_exit(EXIT_FAILURE);
}
if ( !(phrase.T = malloc ( sizeof *(phrase.T)
)))
e_malloc();
instead of
[code:1:c9ebbe2331]if ( !(phrase.T = malloc ( sizeof
*(phrase.T) ))) {
perror("malloc");
_exit(EXIT_FAILURE);
}[/code:1:c9ebbe2331]
my question is, does perror wld still contain the errno message if the
malloc fails
in order to simply my code i have used
void e_malloc(){
perror("malloc");
_exit(EXIT_FAILURE);
}
if ( !(phrase.T = malloc ( sizeof *(phrase.T)
)))
e_malloc();
instead of
[code:1:c9ebbe2331]if ( !(phrase.T = malloc ( sizeof
*(phrase.T) ))) {
perror("malloc");
_exit(EXIT_FAILURE);
}[/code:1:c9ebbe2331]
my question is, does perror wld still contain the errno message if the
malloc fails