Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Operator overloading in C

Status
Not open for further replies.

sacrpio

Member level 3
Joined
May 24, 2004
Messages
56
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
500
operator overloading for union

Dear friends,
Somebody asked me in interview that
1) how operator loading can be implemented in C. Give any example...
2) Give an example of Union Application
3) Give an example of function pointer s use...


Thanks.....
 

Look to the "Thinking in C++" book which is free and available on the internet .
The 1 only relevant to C++
Others are related to both C and C++
 

Sorry but C is a structural or procedural oriented hence operators cannot be overloaded.try C++.

Here is the syntax in C++

<return type> operator<operator>(arguments)
 

the question tells that u r new to C++
i would suggest "let us C++" by yashwant kanetkar to get thorough with the basics of cpp
 

Dear friends,
Somebody asked me in interview that
1) how operator loading can be implemented in C. Give any example...
>> this is related to c++ only
2) Give an example of Union Application
>> union can be used for storing the data when you are writting some structure in which based upon pror value you have to fill state of object like
struct test{
int i;
union condition{
char c;
int d;
}
}
suppose i = 0 then condition will having value of char otherwise int then you can write it like this.

3) Give an example of function pointer s use...
>> The best example of function pointer is for the implimentation of FSM(finite state machine).
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top