Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 178

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 72

Answer:

char *someFun()
{
char *temp = “string constant";
return temp;
}
int main()
{
puts(someFun());
}


Answer:
string constant


Explanation:
The program suffers no problem and gives the output correctly because the character constants are stored in code/data area and not allocated in stack, so this doesn’t lead to dangling pointers.

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 178 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: