4. Given the following declarations of variables to store information on cities (name and size) and regions (name, numbe

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

4. Given the following declarations of variables to store information on cities (name and size) and regions (name, numbe

Post by answerhappygod »

4 Given The Following Declarations Of Variables To Store Information On Cities Name And Size And Regions Name Numbe 1
4 Given The Following Declarations Of Variables To Store Information On Cities Name And Size And Regions Name Numbe 1 (80.4 KiB) Viewed 21 times
Just the answer please.
4. Given the following declarations of variables to store information on cities (name and size) and regions (name, number of cities and cities) to which they belong: typedef struct char Name [10]; // Name of the city int Size; // Number of inhabitants City: typedef struct 1 char Name(10); int Nbrofcities; City cities(10); Regions; Regions VillageLand (5) - 1 { "ClearSkies", 3, {{"Blue", 1000), { "limpid", 10000}, { "Peace", 200}}}, { "Welcome", 2, {{"Rainy", 100), ("Happytown", 200}}}, { "NiceRegion", 3, {{"SandyBeach", 100). "SunnyTown", 10000}, {"Great Hope", 12000}} {"Teranga", 3, {{"Ubuntu", 2000), { "Kongni", 2500}, { "Pineplace", 2500}}}, {"Paix", 1, {{"Peaceland", 7500}}} Regions ptr - &villageLand[0] ; What does the execution of each of the following instructions produce? (a) printf("\n%s", (ptr+3) ->Name); printf("\n%d", ptr[2].Cities [2].Size); printf("\n$c", (++ptr)->Cities [1] . Name [3]); [3] (b) printf("\nThe region is = %s", (* (ptr+5)).Name); [2] (c) printf("\nThere are $s cities in the fd region".VillageLand[2] . NbrofCities), VillageLand [2] . Name); [3]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply