char *someFun()

{

char *temp = “string constant";

return temp;

}

int main()

{

puts(someFun());

}



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

Answer / susie

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.

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Code Interview Questions

find simple interest & compund interest

2 Answers  


plz send me all data structure related programs

2 Answers  


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

0 Answers  


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 Answers  






Find your day from your DOB?

15 Answers   Accenture, Microsoft,


main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }

1 Answers  


Write a procedure to implement highlight as a blinking operation

2 Answers  


Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.

5 Answers   Amazon, Microsoft,


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,


Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.

2 Answers   Mentor Graphics, Microsoft,


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,


Categories