How charater array prints by supplying name of the character array

char a[] = {‘a’,‘b’,’\0’}
cout << a << end;

There is some concept of operator overloading. Can you please elaborate it more ?

you will learn this concept under OOPs concept in cpp. operator overloading is a concept using which you can change the behavior of operators based on the operands.
for eg. what is the default behavior of operator ‘+’. you know its an arithmetic operator and used to add two numeric values.
now when you use ‘+’ operator in two strings, what happens, it concatenate two strings, this means + is overloaded. it changes behavior based on operands.
now these things happens automatically as they are done by cpp developers.
can we do it? Yes.
say you have Student class, and you want to also add two student objects. you want that the numeric values of obejcts gets added and string values gets concatenated when you add two objects of student class using ‘+’ operator. to do this you need to overload + operator for student class.
how to do this? you will learn it later.

thanks

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.