A
arnuld
this is the code:
------------------------------------------------------------------
#include <iostream>
void g(char&){};
void h(const char&) {};
int main() {
char c;
unsigned char uc;
signed char sc;
g(c);
// g(uc);
// g(sc);
// g('a');
// g(49);
//g(3300);
h(c);
h(uc);
h(sc);
h('a');
h(49);
h(3300); }
------------------------------------------------------------------------------
i have 2 questions:
1.) if i can call /g(c)/, why can't i call /g(uc)/ or /g(sc)/ without
any error?
2.) if i compile with "g(uc)", i get an error saying:
"invalid initialization of reference of type 'char&' from
expression of type 'unsigned char'"
BUT nothing wrong happens for "h(uc)". same for all other arguments c,
sc, 49, 3300. why?
------------------------------------------------------------------
#include <iostream>
void g(char&){};
void h(const char&) {};
int main() {
char c;
unsigned char uc;
signed char sc;
g(c);
// g(uc);
// g(sc);
// g('a');
// g(49);
//g(3300);
h(c);
h(uc);
h(sc);
h('a');
h(49);
h(3300); }
------------------------------------------------------------------------------
i have 2 questions:
1.) if i can call /g(c)/, why can't i call /g(uc)/ or /g(sc)/ without
any error?
2.) if i compile with "g(uc)", i get an error saying:
"invalid initialization of reference of type 'char&' from
expression of type 'unsigned char'"
BUT nothing wrong happens for "h(uc)". same for all other arguments c,
sc, 49, 3300. why?