What will be the output of the following C code?#include struct point{int x;int y;};struct notpoint{int x;int y;};struct point foo();int main(){struct point p = {1};struct notpoint p1 = {2, 3};p1 = foo();printf("%d\n", p1.x);}struct point foo(){struct point temp = {1, 2};return temp;}

🎲 Try a Random Question  |  Total Questions in Quiz: 143  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
C Programming Practice Test: Structures, Unions and Bit-Fields — practice the complete quiz, review flashcards, or try a random question.

Quiz questions on: Structures basics, functions, arrays of structures, pointer to structires, self referential structures, table lookup, typedefs, unions and bit fields. Structures: A structure is a user-defined data type that allows you to group together related data items. For example, you could create a structure to store information about a person, such as their name, age, and address. To declare a structure, you use the struct keyword followed by the name of the structure and a list of its members. Each member of a structure must have a type and a name. Once you have declared a... Show more

What will be the output of the following C code?<br>#include <stdio.h><br>struct point<br>{<br>int x;<br>int y;<br>};<br>struct notpoint<br>{<br>int x;<br>int y;<br>};<br>struct point foo();<br>int main()<br>{<br>struct point p = {1};<br>struct notpoint p1 = {2, 3};<br>p1 = foo();<br>printf("%d\n", p1.x);<br>}<br>struct point foo()<br>{<br>struct point temp = {1, 2};<br>return temp;<br>}