Interview Question


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
2
of 4 vote

abc is pointer to function returning void, which takes 2 arguments: int and def, where def is a pointer to a function returning void and taking no arguments.

- Anonymous June 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

the above answer is wrong! I don't understand why someone vote it ,

what Anonymous described should be something like this :

{
void (*abc)(int, void (*def)());

}
but ...
Note void (*abc(...))(), what does this mean is abc return pointer to a function which take no args and return void, that is what abc is ,abc take a function pointer and return the same type of function pointer,
you can do this

{
    void(*def)();
    void (*abc(int, void(*def)()))();
   def=(*abc)(0,def);

}
to simplify this ,we can use typedef

{
	typedef void(*q)();
        typedef q (*p)(int,q);
       // then we can do something like below:
	q b;
	p a;
	b=(*a)(0,b);

}

- Charles December 28, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

abc is a pointer to function returning void and taking two parameters of which one is integer and another is def, a pointer to function taking no arguments and returning void (nothing).

- sourav June 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

void (*def)() is a function pointer which points a function without argument and return value.
Abc(int, void (*def)()) is a function with two arguments first is int, second is a function pointer.
void (*abc(int, void (*def)()))() is a function pointer without return value and argument. and the pointer is returned from abc(int, void (*def)()).

this is a typical function pointer definition void(*fun)(), but for this void (*fun(...))()???

- Bin December 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the above ans is correct and is a call back function.

- Thirumal June 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

abc is a function pointer that takes no parameter and returning A FUNCTION POINTER, the returned function pointer is of the function type which returns void and takes an integer and another function pointer. This other function pointer points to a function that takes no parameters and returns void.

- anonymous June 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

abc is a function (int, pointer to function returning void)
returning pointer to a function returning void

- Anonymous June 07, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More