Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
497 views
in Arrays and Structures by (49.1k points)
closed by

What is the difference among the following two programs?

(a) #include

struct point { double x; double y;};

int main() 

{

struct point test;

test.x = .25; testy = .75;

cout << test.x << test.y;

return 0;

}

(b) #include

struct { double x; double y;} Point;

int main(void) {

Point test={.25,.75};

return 0;

}

1 Answer

+1 vote
by (54.8k points)
selected by
 
Best answer

(a) Output

1. 0.250.75 

2. Named structure point is created.

(b)

1. No output: Error 

2. Anonymous structure point is created.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...