what is the output of this code? template<class t> void f(t){ static int I=0; cout<<I++; } int main (){ f(1); f(1.0); f(1); } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the output of this code? template<class t> void f(t){ static int I=0; cout<<I++; } int main (){ f(1); f(1.0); f(1); }

plz give the solution.

24th Jul 2016, 5:22 PM
Darsh Shah
Darsh Shah - avatar
3 Answers
+ 1
output is 012
15th Sep 2016, 2:56 PM
Omar Al Fahad
Omar Al Fahad - avatar
0
I ran the code and it crashed the application. did you get the same ?
25th Jul 2016, 7:53 PM
Jetset Willy
Jetset Willy - avatar
0
yup.
26th Jul 2016, 3:22 AM
Darsh Shah
Darsh Shah - avatar