Pls give ans to these qns.....

Status
Not open for further replies.

sajeev

Advanced Member level 4
Joined
Apr 29, 2005
Messages
112
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Location
Kerala-India
Activity points
2,197
1. Difference between c and c++ structure?
2. What are virtual functions?
3. How we write a programe such that it will delete itself after execution?
4. Difference between calloc and malloc?
 

A1: 'structures' are the same in both C and C++. Declaration as well as definition. However C++ has a special type of structure that is called CLASS (if you're not aware of OOP). A class is very similar to a structure but can have 'member functions' as well.

A2: Keyword VIRTUAL is related to a concept in OOP called POLYMORPHISM which means that ability to take many forms. It allows the same function to perform a different operation according to the class it is used with.

A3: although your question is not clear. Still, you may use some operating system function to delete the file at the end of the program (call the function at the end of the program). The file WILL get deleted b/c the program gets loaded into memory when you run it and operates from there if it is not a huge one.

A4:calloc allocates memory and initializes it to all zeros. malloc allocates memory but doesn't initialize it, so it still contains garbage.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…