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
What does volatile do?
What is const and volatile in c?
What is the difference between fread and fwrite function?
can any one provide me the notes of data structure for ignou cs-62 paper
Explain what will the preprocessor do for a program?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What is the purpose of sprintf?
What are reserved words with a programming language?
What is zero based addressing?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Explain spaghetti programming?
Explain the difference between null pointer and void pointer.
Where in memory are my variables stored?
how logic is used
Why is c called a mid-level programming language?