Interview Questions on Structures in C

by Sridhar Jammalamadaka on September 10, 2009


c interview questions

A set of interview questions on structures in C.

  1. What is a structure?
  2. What are the differences between structures and unions?
  3. What are the advantages of using unions?
  4. How can you use typedef to define a type of structure?
  5. Write a C program that returns 3 numbers from a function using a structure.
  6. In below code snippet:

    struct Date {
     int yr;
     int day;
     int month;
    } date1,date2;
    date1.yr = 2004;
    date1.day = 4;
    date1.month = 12;
    

    Write a function in C that assign values to date2. Arguments to the function must be pointers to the structure Date and integer variables date, month, year.


About the Author:  Sridhar Jammalamadaka is the Editor of Interview Mantra. He's a typically non-typical Software Engineer from Pune, India. He likes entrepreneurship, web technologies and Micro Controller programming. He enjoys playing cricket and piano (but rarely does these activities). Through this website, he wishes to gather a large community of aspiring engineers, entrepreneurs and professionals from all parts of the globe. You can connect with him on Facebook - http://www.facebook.com/sridhar.j


2,274 readers have already subscribed to email updates!

Enter your email address:

  • jitendra kumar

    thinx sir,

Previous post:

Next post: