C++ question: where does int() come from ?

Michael Gong mwgong@cs.utoronto.ca
Wed Dec 20 04:16:00 GMT 2006


Following is a simple C++ program:

#include<iostream>

use namespace std;

int main() {
    cout << "int value = " << int('A') << "\n";
}


It outputs the integer value of character 'A'.

Is the int('A') a function call provided by C++ library or the compiler 
will do the conversion during compilation time ?


Regards,

Mike




More information about the Gcc-help mailing list