I doubt regarding c program, how to store values in a function,if I call a function the variables are initialized and previous values are deleted so how can I store values in functions.
#include <avr/io.h>
#include <util/delay.h>
#include "buzzer.h"
void ReachDestinationAvoidingNode(unsigned char Xd,unsigned char Yd,unsigned char Xn,unsigned char Yn)
{
}
//Do not make changes in main function
int main(void)
{
ReachDestinationAvoidingNode(5,'D',6,'D');
buzzer_on();
_delay_ms(500);
buzzer_off();
ReachDestinationAvoidingNode(2,'F',2,'D');
buzzer_on();
_delay_ms(500);
buzzer_off();
ReachDestinationAvoidingNode(2,'A',2,'C');
buzzer_on();
}
now when the ReachDestinationAvoidingNode(5,'D',6,'D')
function is called the 5,D
values should be stored and again when the ReachDestinationAvoidingNode(2,'F',2,'D')
called the 5,D
values should be used. how to do that,
without disturbing main code