Reference parameter with default value in a function

Hi there,

I’ve just finished the pointers/references chapter and I wonder how can I create a function declaration that has a typesafe null reference as a default value?
Something like:

void square(int &num = NULL){
    if(num == NULL){
        std::cout << "Here goes nothing!" << std::endl;
    } else {

I used “NULL” because I don’t know what else I should use… :slight_smile:


I guess it wouldn’t make sense, since references can’t be changed once assigned… but anyways, curious to know.