How to assign a single value to several variables in one line with C

1 Answer

0 votes
#include <stdio.h>

int main(void)
{
    int a, b, c, d;
    
    a = b = c = d = 9;    
    
    printf("%d %d %d %d\n", a, b, c, d);

    return 0;
}



/*
run:

9 9 9 9

*/

 



answered Jul 9, 2024 by avibootz
...