T
TaxicabNumber
main()
{
int num;
while(..)
{
num=atoi(str+x)
if(num!=0)
{
....
....
}
else
{
printf("num = %d",num);
}
}
I am not able to access the value of num in the else block. It prints
zero. I am very new to C and as far as I know, num should be accessed
in the else block also as it is declared in the main block which is
actually is the parent block and I guess at runtime, the parent block
is checked for a variable value if that variable is not decalred in
that block.
regards,
vz.
{
int num;
while(..)
{
num=atoi(str+x)
if(num!=0)
{
....
....
}
else
{
printf("num = %d",num);
}
}
I am not able to access the value of num in the else block. It prints
zero. I am very new to C and as far as I know, num should be accessed
in the else block also as it is declared in the main block which is
actually is the parent block and I guess at runtime, the parent block
is checked for a variable value if that variable is not decalred in
that block.
regards,
vz.