New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Question about the output from a code
Why the outcome of this code is not 4? Am I missing something? #include <iostream> using namespace std; int f(int k){ k++; return k; } int main() { int k{2}; k++; /*k=3*/ f(k); /*inside the function, it has k++,so k should be 4(?!)*/ cout<<k; return 0; }
1 Answer
+ 1
oh I missed that. Thx xD