GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 18 of 255    Print  
Difference between "C structure" and "C++ structure".

  
Total Answers and Comments: 15 Last Update: July 29, 2007   
  
 Sponsored Links



 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
July 20, 2005 12:48:49   #1  
Piyush/Santosh        

RE: Difference between "C structure" and "C++ structure".
The defination of the structure in C is limited to within the module and cannot be initialized outside its scope. Where as in C++ you can initialize the objects anywhere within the boundaries of the project.
 
Is this answer useful? Yes | No
July 23, 2005 01:35:35   #2  
Girish        

RE: Difference between "C structure" and "C++ structure".
The on more deference is , in C++ structure can have methods(procedures) but C can note have methodes in structure
 
Is this answer useful? Yes | No
August 25, 2005 10:54:17   #3  
satish        

RE: Difference between "C structure" and "C++ structure".
By default C structure are Public whil C++ structure are private 

 
Is this answer useful? Yes | No
December 31, 2005 07:20:23   #4  
prafull        

RE: Difference between "C structure" and "C++ structure".
c can have methods in structures dude..
 
Is this answer useful? Yes | No
February 26, 2006 13:44:03   #5  
Rohan Member Since: November 2005   Contribution: 11    

RE: Difference between "C structure" and "C++ structu...

C does not support Methods inside structure.

Reason :

╔═[■]═══════════════════════
║#include <stdio.h>
║#include <conio.h>

║struct temp
║{
║  int a;
║  get_data()
║  {

      printf("Enter value of a : ");
║    scanf("%d",&a);
║  }
║}T;

║void main()
║{
║   T.get_data();
║}

saved  file as ".c" file
Error : Function May not be part of structure of Union
and same code will run if you save file as ".cpp"


 
Is this answer useful? Yes | No
March 27, 2006 05:54:49   #6  
Yashwant S pinge        

RE: Difference between "C structure" and "C++ structure".
Since , bydefault, C and C++ structure members are public.In C, you can declare structure as struct A a;But not A a(which is possible in C++);
 
Is this answer useful? Yes | No
June 04, 2006 15:12:48   #7  
rajesh        

RE: Difference between "C structure" and "C++ structu...

I cant able understand your answer. Please tell what method difference in C and C++. Please explain briefly. Please Reply to my ID

By,

RajeshKumar.J


 
Is this answer useful? Yes | No
June 26, 2006 11:41:52   #8  
Anupama        

RE: Difference between "C structure" and "C++ structu...

Mr Rohan,

I actually tried saving the code you have given with extention .c and .cpp and it runs for both... So, I dont understand how you are saying that methods are possible only in the case of structures of cpp... could you clarify my query?

Thank you


 
Is this answer useful? Yes | No
August 25, 2006 09:44:05   #9  
Siddharth Nimkar        

RE: Difference between "C structure" and "C++ structure".
Turbo C will allow you to run the above code with .c extension.But try running the code in Dev C++ (this is another IDE) this will give you error. I guess Dev C++ uses "gcc"
 
Is this answer useful? Yes | No
October 04, 2006 10:28:26   #10  
avishek        

RE: Difference between "C structure" and "C++ structure".
C++ structures are also by default public
 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links



 
Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape