int main()
{ char *arr="\\0\1\8234\0"; int i=0;
while(arr[i])
{ switch(arr[i])
{
case '0': printf("is no"); break;
case '00': printf("is debugging\n"); break;
case 0: printf("It is Avishkar\n"); break;
case '\\': printf("This "); break;
case '\1': printf("t s"); break;
case '8': printf("o s"); break;
case '2': printf("imp"); break;
case '3': printf("le as"); break;
case 2: case 3: case 4:
case 8: printf("This "); break;
default: printf(" it seems\n"); break;}
i++; } }
please explain the o/p ?
i am not able to get it..
Breaking down the string initialization we have:
The loop prints for each successive value of i:
literally:
This is not so simple as it seems
The trailing \0 is to cause the while( arr[ i ] ) to fail and the loop to stop when i == 7.
Although this will probably cause the compiler to complain on non-microsoft compilers.