I am new to the C language and I'm trying to write a simple self banking console program. I want to make a function to generate an account number so I wrote the code below:
int first = 7856123490;
int accountNumber;
int generateAccNo ()
{
printf("%d", first);
first = first + 1;
accountNumber = first;
return (accountNumber);
}
The whole idea here is that when I call this function, it will get the value in variable called first and add 1 to it and replace the value of first and return that value as accountNumber.
As I expect the first time this function runs it should return 7856123491 this value and the second time it should return 7856123492. So how can I do that?