Whats wrong with the following function

char *string()
{
char *text[20];
strcpy(text,"Hello world");
return text;
}

Answer Posted / qint

1. returning address of a local variable.
2. wrong parameter passed to strcpy()

Is This Answer Correct ?    4 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by keywords in c?

624


What is NULL pointer?

674


How can I read and write comma-delimited text?

619


What does the file stdio.h contain?

602


What are the advantages and disadvantages of c language?

560






Explain void pointer?

589


Tell me when is a void pointer used?

648


can any one tel me wt is the question pattern for NIC exam

1558


why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

609


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

1789


What is variable and explain rules to declare variable in c?

553


Tell us two differences between new () and malloc ()?

613


Explain what is the most efficient way to store flag values?

695


What does %d do in c?

542


I came across some code that puts a (void) cast before each call to printf. Why?

678