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 is an identifier?

806


Why enum is used in c?

698


What is signed and unsigned?

823


Which is best book for data structures in c?

814


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

1836


Explain Function Pointer?

884


What is boolean in c?

817


Simplify the program segment if X = B then C ← true else C ← false

2792


Why #include is used in c language?

785


Describe dynamic data structure in c programming language?

809


Where are local variables stored in c?

762


What is the difference between local variable and global variable in c?

912


Describe the order of precedence with regards to operators in C.

830


What is the difference between array and linked list in c?

857


What are the differences between Structures and Arrays?

844