Whats wrong with the following function
char *string()
{
char *text[20];
strcpy(text,"Hello world");
return text;
}
Answer Posted / vignesh1988i
as for as i know , there is only one error..... you have
declared text as array of pointers and not as character data
array..... so this text can only accept addresses.... :)
char *text[20] means you are going to store 20 addresses in
this array..... When you store addresses using arrays , the
that is called array of pointers....
if u declare : char text[20] , this will work correctly..
thank u
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
Who developed c language and when?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
What are the types of macro formats?
write an algorithm to display a square matrix.
what type of questions arrive in interview over c programming?
How many types of operator or there in c?
Describe the steps to insert data into a singly linked list.
What are local static variables? How can you use them?
Is it possible to have a function as a parameter in another function?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
What are the main characteristics of c language describe the structure of ac program?
How can I swap two values without using a temporary?
How do you override a defined macro?
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
Explain argument and its types.