how does logical and work during assignment

what’s happening in this case:

int i = 4;
int j = i && 1;

now i have j = 4 and i = 1. How ?

I think it should be other way round. i will remain 4 and j will be true which is promoted to 1.

when we deal with logical operators we deal in binary digits. If a number is non zero treat it like 1. So 1&&1 this operation results true, that is one. Also, i will remain 4 and j will be updated to 1. Sorry for bad English.

Read the question and answers on this link. This question refers to a problem just like yours.

Can anyone explain why the x is displaying value 1 instead 2

Hope this is helpful