What will be the output of the following C code? [code]#include <assert. h> #include <stdio . h> #include <stdlib.h> void -Assert (char

What will be the output of the following C code?
Code:
#include <assert. h> 
#include <stdio . h>
 #include <stdlib.h> 
void -Assert (char *mesg) 
{
   fputs (mesg, stderr); 
   fputs (" -- assertion failed\n" , stderr); 
   abort () ; 
}
A. prints only assertion message
B. program is just aborted
C. prints assertion message and aborts
D. no action takes place
 
Answer: c
Explanation: The given function uses assert function as defined in assert.h.The program writes assertion message on the stanard error file(stderr) and then calls abort() function to terminate the execution of the program.
 

Tìm kiếm

Back
Top