Interview Questions on Structures in C


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



All comments of post - "Interview Questions on Structures in C":

:Haha! I'am the first! Yeh~

Thank you!

Add a Comment / Trackback url

Comment begin from here or jump up!