C language, assigning multiple variables at the same time

Continuous assignment is absolutely not allowed in C language! ! ! This is the basic requirement of the C language.

can int a,b,c; a=5;b=5;c=5;

or int a =5;int b=5;int c=5;

but!

Absolutely not: int a=b=c=5. Because b and c are not yet defined. Here just defines a and assigns a value to a.

Correct way:

int a , b , c ;

a = b = c = 5 ;

or,

int b,c; int a = b = c = 5;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324147970&siteId=291194637