The following is illegal. Why? How would you correct it?

Q12. The following is illegal. Why? How would you correct it?

main()

{

        int i=j=k=0;

}

Ans. This is illegal because multiple assignment statement requires pre-declaration of variables. Therefore, the correct way to do so it as shown below:

main()

{

int I, ,j ,k;

i=j=k=0;

}

Leave a Reply

Your email address will not be published. Required fields are marked *

60 Views
%d bloggers like this: