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

What is data _null_? ,Explain with code when u need to use it in data step programming ?

0 Answers   Abbott,


Program to find the largest sum of contiguous integers in the array. O(n)

11 Answers  


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }

1 Answers  


void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }

1 Answers  


main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers   CSC,


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error

1 Answers   HCL,


What are the files which are automatically opened when a C file is executed?

1 Answers  


How we will connect multiple client ? (without using fork,thread)

3 Answers   TelDNA,


abcdedcba abc cba ab ba a a

2 Answers  


Categories