Page 1 of 1

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

Posted: Fri Apr 29, 2022 6:34 am
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 23 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]