+ 3

what is the output put of the following program? int main () { int x=5; static int y =x; prinf("%d", y) ; }

what is ans..

10th Sep 2019, 5:17 PM
Vaibhav Karma
Vaibhav Karma - avatar
4 Respuestas
+ 4
I think error ...illegal initialization
10th Sep 2019, 5:41 PM
Vikash Karma
Vikash Karma - avatar
+ 4
It will give compile time error..bcoz dynamic initialization is not available in C language.. And as ~ swim ~ said try understanding yourself first..and I guess this is basics of C language so you might want to revise your C tutorial..
11th Sep 2019, 2:24 AM
Alaska
Alaska - avatar
+ 3
Error because static variables are created at the time of loading while the local variables are created when the scope comes inside curly braces. So firstly static variable y is created and till now there us no variable named x. So its raise an compile time error
11th Sep 2019, 3:04 AM
Sudhir
Sudhir - avatar