Skip to content

Latest commit

 

History

History

6.Structures

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Robot Structure Program - C

This repository contains a simple C program that demonstrates the use of structures to represent a robot with a name and battery level.

Explanation:

  1. Structure Definition:
  • The program defines a struct named Robot that has two members:
    • char name[20]: An array of characters to store the robot's name.
    • int batteryLevel: An integer to store the robot's battery level as a percentage.
  1. Main Function:
  • A variable robo1 of type struct Robot is created and initialized with the name "Robo1" and a battery level of 100%.
  • The program then prints the robot's name and battery level to the console.