answersLogoWhite

0

C coding for operator overloading

Updated: 8/17/2019
User Avatar

Wiki User

15y ago

Best Answer

C does not support operator overloading.

If you mean C++ operator overloading, it depends on exactly what you wanted to do. If you wanted to '+' to strings, then you could write:

string operator+(string a, string b) {

// do something

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C coding for operator overloading
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is it possible to do operator overloading in c?

No. Operator and/or function overloading is only a C++ thing.


What is an operator overloading in C?

one function but multiple behaviours depending on the parameters


Why should you have to use comparison operator overloading in pairs in c?

You cannot overload operators in C. This is a C++ thing only.


Operator overloading is possible in java or not?

Java does not support opperator overloading, so the answer to your question is: none.


Why do you use of operator overloading in c?

Overloading, Overriding, Polymorphism, Information Hiding, Inheritance all these are CONCEPTS of C++ and Java. An Object Oriented Language and not of C language. Thats why Bjarne Stroustrup came up with C++ ...


Why use new and delete operator overloading in c plus plus?

one reason to use new and delete operator overloading in c++ is when you are using your own memory manager code. when the user of your code calls the new keywork, your memory manager code can allocate memory.


How do you find largest of two object using operator overloading in c?

I will not use operator overloading in C# to do anything. Operator overloading may lead to one operator has more than 1 semantic meaning. For example, we know 1 + 2 yields 3, and "1" + 2 yields "12". I do not like this overloading of the operator + being used for addition in Number hierarchy, while as the concatenation in strings. That is, one operator (+) has 2 significant semantics.And the question "find largest of two object" is too vague - what do you mean "largest"? and object? We know apple and orange are 2 objects, but how do you compare them, and find the largest one?????? (size, price or what???)


What does the job of c operators consist of?

A C operator is not a job or profession but rather a coding language. C operators perform certain tasks in programming such as a "+ " operator performs addition.


What is operator overloading?

I think you mean operation overlord??? It is the American, Canadian and British offensive on Europe in World War 2. They landed in Normandy on 6th June 1944 (Commonly called D-Day, Day of Days or Deliverance Day) and progressed throughout France liberating Paris on the 25th August. This allowed the allies a foothold in Europe.


When an operator works on various type of operands is called?

operator overloading


What are the advantage and disadvantage of operator overloadin?

Operator overloading allows c/c++ operators to have user defined meanings on user defined types. For example + operator is used to add to numbers but we can also use it for concatenating a string the only limitation is you cannot change the literal meaning of the operator.


How operator overloading differ from function overloading?

Function overloading is multiple definition with different signatures(the parameters should be different) for the same function. The parameter list have to be different in each definition. The compiler will not accept if the return type alone is changed. Operator overloading is defining a function for a particular operator. The operator loading function can not be overloaded through function overloading.