ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
f(*p)
   {
   p=(char *)malloc(6);
   p="hello";
   return;
   }
   main()
   {
   char *p="bye";
   f(p);
   printf("%s",p);
   }
   what is the o/p?
 Question Submitted By :: Harish
I also faced this Question!!     Rank Answer Posted By  
 
  Re: f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?
Answer
# 1
actually the above programme produces an error.because u've 
to mention which type of pointer it is at fuction f(*p). 
i.e f(char *p).
if u correct this error.then the out put will be
        bye
 
Is This Answer Correct ?    0 Yes 0 No
Fazlur Rahaman Naik
 
  Re: f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?
Answer
# 2
after correction of error, the output will be hello
 
Is This Answer Correct ?    0 Yes 0 No
Subbu
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... } TCS4
what does " calloc" do? Cadence6
True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type  4
Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4 Mascot2
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output? Ramco4
f(char *p) { p=(char *)malloc(sizeof(6)); strcpy(p,"HELLO"); } main() { char *p="BYE"; f(p) printf("%s",p); } what is the output? Hughes6
Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.  2
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice) Subex1
What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); } ADITI2
post new interiew question and aptitude test papers  1
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?  1
why we shiuld use main keyword in C  4
How can I invoke another program from within a C program?  1
How would you find a cycle in a linked list?  2
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language  1
pick out the odd one out of the following a.malloc() b.calloc() c.free() d.realloc() TCS1
what is a headerfile?and what will be a program without it explain nan example? Assurgent2
How to implement call back functions ? HP1
What's wrong with "char *p = malloc(10);" ?  4
1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision Qualcomm4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com