Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Intro to C programming 1. Write a program named DynamicStructs . Create a data s

ID: 3683736 • Letter: I

Question

Intro to C programming
1. Write a program named DynamicStructs. Create a data structure for automobiles. It should have the name of the car, the color, etc. Dynamically allocate a data structure, ask the user to enter the information from within a function named EnterInfo, then display the information in a function named DisplayInfo. Intro to C programming
1. Write a program named DynamicStructs. Create a data structure for automobiles. It should have the name of the car, the color, etc. Dynamically allocate a data structure, ask the user to enter the information from within a function named EnterInfo, then display the information in a function named DisplayInfo. Intro to C programming

Explanation / Answer

#include <stdio.h>
#include <string.h>

struct Automobiles {
   char name[50];
   char color[50];
    char type[50];
   int   price;
};

int main( ) {

   struct Automobiles vehicle1;
   void enterInfo( struct Automobiles vehicle1);
   void DisplayInfo( struct Automobiles vehicle1);
   enterInfo(vehicle1);
   DisplayInfo(vehicle1);
   return 0;
}
void enterInfo( struct Automobiles vehicle1)
{
   strcpy(vehicle1.name, "HONDA CITY");
   strcpy(vehicle1.type, "Sedan");
strcpy (vehicle1.color, "Blue");
   vehicle1.price = 1000000;

}
void DisplayInfo( struct Automobiles vehicle1) {

   printf( "Vehicle name : %s ", vehicle1.name);
   printf( "Vehicle type : %s ", vehicle1.type);
   printf( "Vehicle color : %s ", vehicle1.color);
   printf( "Vehicle price : %d ", vehicle1.price);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote