hey guys,
I am writing a code and have a problem I hope you can help me. :)
As you maybe can see in my code below I am trying to create a declaration of a variable that contents of a Char"K" and a number(1,2 or 3).
In each loop the number should go up but the "K" should stay.
So after the loops i should have
K1=random number[0,18]
K2=random number[0,18]
...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include "stdio.h"
#include "cstdlib"
#include <time.h>
int i, K1, K2, K3;
void main()
{
for (i = 1; i <= 3; i++)
{
srand((unsigned)time(NULL));
K"i" = (rand() % 19);
printf("%d", "K"i);
}
}
Obviously this code doesn't work. So the question is how can i create a declaration of a variable out of a Character and an other variable.