I was trying the following code out.
int index, use, comp;
for (index = 0; index < 3; index++)
{
if (user1.equalsIgnoreCase(options[index]))
{
use = index;
}
}
for (index = 0; index < 3; index++)
{
if (opt.equalsIgnoreCase(options[index]))
{
comp = add + index;
}
}
int sum = comp + use;
At the line int sum = comp + use;
, I am getting an error saying that variables comp and use are not initialized. How can I store the values I had gotten during the execution of the loop in these variables?