Project 1 - Creation of user defined data type to implement the user interfaces for working with ‘Set’ (Mathematical Set theory) using Linked List
/*
====================================.h========================================
Name : project1.c
Author : siva perumal
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
typedef enum States
{
STATE_A,
STATE_B,
STATE_C
}State_Type;
static volatile int clock =
0;//input for changing the State
static volatile int out;//Output on entering a new State
State Type current_state;
void Init_State_Machine()
{
//System Initialized and its in State A
current state = STATE_A;
clock = 0;
out = 0;
printf("State Machine is initialized & Program is in State_
}
void State_B()
{
void State_B()
{
//When System is in State B,Out instruction is executed
out = 1;
printf("Program is in State_B & Value of out is %d\n", out);
clock++;
printf("Clock value is : %d\n", clock);
//switch over to another state
if (clock 5)
=
{current_state = STATE_C;}
}
void State_C()
{
//When System is in State C,Out instruction is executed
out = 2;
printf("Program is in State_C & Value of out is %d\n", out);
clock++;
printf("Clock value is : %d\n", clock);
//switch over to another state
if (clock == 9)
{
//system reset
current_state = STATE_A;
}
void
{
}
clock = 0;
State_A()
//When System is in State A,Out instruction is executed
out = 0;
printf("Program
is in State_A & Value of out is %d\n", out);"
}
}
}