When looking over some code from a friend's project, I recently saw syntax that looked like this.
#include <iostream>
int main(){
std::cout<< int(32.5/5) << std::endl;
}
When you run the above code, you get 6
, which is the expected value if the use of int
functions like a cast.
However, I have never seen this syntax before and I could not find documentation for it on the web. I also did an experiment and noticed that this syntax is not valid in C
.
Can someone explain the meaning of this syntax with documentation references?