Home / Tips / C Tips / C: Can you analyse the following statement? What is being printed?

“Chishiki” is Japanese for “knowledge.” e-chishiki.com aims to bring software developers, information security professionals, IT executives and other IT pros a rich body of knowledge in the form of articles, interviews, tutorials and technical discussions. Our contributors are among the biggest names in the Indian IT industry and include noted authors, educators and practitioners.

C: Can you analyse the following statement? What is being printed?


Can you analyse the following statement? What is being printed?

printf ( "%d", ( x.a[i] )( p, q, r ) -> k ) ;

x is a structure variable. One of its elements is an array of pointers to functions. We are picking the ith pointer from this array. Using this pointer we are making a call to the function and passing it the arguments p, q, and r. The function in turn is returning a pointer to a structure, say z. We are printing an integer k which is an element of the structure z. Can you now write the prototype of the function being called?

The prototype would be:

struct z *f ( int p, int q, int r ) ;

Comments

Log in or create a user account to comment.

On Sale From April 2008

Let Us C
8th Ed.
C programming classic & best seller. 1 million+ copies sold!

Y. Kanetkar

On Sale From April 2008

Introduction to Object Oriented Programming & C++

Y. Kanetkar

On Sale From Fall 2008

Microsoft .NET Framework: Web Application Security

Vijay Mukhi

On Sale From Nolvember 2008

Quest C++ Courseware
12+ hours of instructional audio and animated slides.

Y. Kanetkar Asang Dani

On Sale From November 2008

A Programmer's Guide to Web Application Security

Vijay Mukhi

Latest Forum Posts