C++ functions | Sololearn: Learn to code for FREE!

-1

C++ functions

If I use 3 functions, in what order does c++ call the functions? for example: #include <iostream> int func1(){ return 56; } int func2(){ return 2; } int func3(){ return 3; } int main(){ std::cout<<func1()-(func3()/func2())<<std::endl; return 0; }

c++

8/7/2022 11:41:29 AM

selim sultan çorbacı

1 Answer

New Answer

+3

According to precedence and Associativity of operators .. On equal precedence, left to right... func1() , func3(), func2().. func3() /func2() =>3/2=1 func1() - 1 56-1=55 edit: selim sultan çorbacı https://en.cppreference.com/w/cpp/language/operator_precedence https://docs.microsoft.com/en-us/cpp/cpp/cpp-built-in-operators-precedence-and-associativity?view=msvc-170 https://www.programiz.com/cpp-programming/operators-precedence-associativity