What is wrong with the following code?

int *foo()

{

int *s = malloc(sizeof(int)100);

assert(s != NULL);

return s;

}

Answer Posted / susie

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.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

726


how to test pierrot divisor

2453


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2494


Cluster head selection in Wireless Sensor Network using C programming language.

3368


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

2123






how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3338


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1289


How to palindrom string in c language?

9763


Write a program to model an exploding firecracker in the xy plane using a particle system

3861


Write a routine to implement the polymarker function

4574


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2561


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

3238


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2345


write a program for area of circumference of shapes

2223


What is full form of PEPSI

2114