Untitled
unknown
c_cpp
2 years ago
927 B
6
Indexable
#include <stdio.h>
#include <string.h>
struct Car
{
char name[ 30 ];
int productionYear;
int maxSpeed;
} citron;
typedef struct VoicePanelManager
{
char name[ 30 ];
int maxSound;
int minSound;
} VPM;
void showInfo( struct Car car )
{
printf("Car name: %s\n", car.name );
printf("%s production year: %d \n", car.name, car.productionYear );
printf("%s max speed: %d \n", car.name, car.maxSpeed );
printf("\n");
}
int main( void )
{
struct Car audi, bmw;
strcpy( audi.name, "Audi" );
audi.productionYear = 2017;
audi.maxSpeed = 280;
strcpy( bmw.name, "BMW" );
bmw.productionYear = 1999;
bmw.maxSpeed = 180;
showInfo( audi );
showInfo( bmw );
struct Car* carPtr = &audi;
carPtr->maxSpeed = 300;
showInfo( audi );
VPM vpm1;
citron.maxSpeed = 170;
return 0;
}
Editor is loading...
Leave a Comment