Question
What is wrong with the following code?
int *foo(){
int *s = malloc(sizeof(int)100);
assert(s != NULL);
return s;
}

Answers

Answer & Explanation:
assert macro should be used for debugging and finding out bugs. The check s != NULL is for error/exception handling and for that assert shouldn’t be used. A plain if and the corresponding remedy statement has to be given.   Your Comment






Search
Can you Answer!!
  • Q Who led the first organized strike of Agricultural labourers it Travancore?
  • Q Advertising slogan - No one ever got fired for buying what
  • Q 6 year old child who had a history of primary herpes simplex has got a recurrent infection. What is the likely cause:
  • Q Explain what are relevant metrics for tracking roi on social media?
  • Q How is the memo text box in bills, invoices, checks, etc. Useful for report filtering and transaction research?
  • Q Where is the National Centre for Antarctic and Ocean Research located?
  • Q What is the FAMILY for harbor seal?
  • Q The 2013 Moortidevi Award winning novel Theekkadal Kadanju Thirumadhuram, by Radhakrishnan, is based on whose life?
  • Q I get a database error on kali linux. How do i fix it?
  • Q What differentiates one ‘dunning level’ from another?
  • Q Any idea of Kyoto Protocol issues?