ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Code Snippets >> Programming Code >> C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions (401)
 C++ Code interview questions  C++ Code Interview Questions (121)
 VC++ Code interview questions  VC++ Code Interview Questions (2)
 Java Code interview questions  Java Code Interview Questions (58)
 Dot Net Code interview questions  Dot Net Code Interview Questions (113)
 Visual Basic Code interview questions  Visual Basic Code Interview Questions (8)
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions (37)
Question
# include<stdio.h>

      aaa() {

        printf("hi");

       }

      bbb(){

       printf("hello");

       }

      ccc(){

       printf("bye");

       }

      main()

      {

        int (*ptr[3])();

        ptr[0]=aaa;

        ptr[1]=bbb;

        ptr[2]=ccc;

        ptr[2]();

      }
 Question Submitted By :: C-Code
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
Answer :

bye

Explanation:

ptr is array of pointers to functions of return type
int.ptr[0] is assigned to address of the function aaa.
Similarly ptr[1] and ptr[2] for bbb and ccc respectively.
ptr[2]() is in effect of writing ccc(), since ptr[2] points
to ccc.
 
Is This Answer Correct ?    1 Yes 0 No
Susie
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list) Disney 3
Link list in reverse order. NetApp 8
void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(%d, i); }   2
main() { unsigned int i=10; while(i-->=0) printf("%u ",i); } Hp 1
main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above HCL 2
Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?   1
What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }   1
Is it possible to type a name in command line without ant quotes? Infosys 1
#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); } Quick-Heal 1
main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }   1
main() { printf("%x",-1<<4); } HCL 3
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }   2
 
For more C Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com