Difference between Class and Struct.

Answers were Sorted based on User's Feedback



Difference between Class and Struct. ..

Answer / ravish

Structure is a value type variable, but a class is a
reference type variable.
We can create an object of a class but not for a structure.
Structures does not have function definition but a class has..

Is This Answer Correct ?    6 Yes 7 No

Difference between Class and Struct. ..

Answer / farhat khan

In C struct does not use function(method).

Is This Answer Correct ?    6 Yes 10 No

Difference between Class and Struct. ..

Answer / naksh @tcs

The major difference between struct and class is :
Struct donot contain functions(methods) as its members.

Yes, by default members of struct are public and that of a
class are private.

Is This Answer Correct ?    33 Yes 79 No

Post New Answer

More C Interview Questions

write a C code to reverse a string using a recursive function, without swapping or using an extra memory.

9 Answers   Motorola, TCS, Wipro,


how to set Nth bit of a variable?

1 Answers  


difference between i++* and *++i

6 Answers   IBM,


How to write a multi-statement macro?

0 Answers  


Difference between exit() and _exit() function?

0 Answers  






int arr[] = {1,2,3,4} int *ptr=arr; *(arr+3) = *++ptr + *ptr++; Final contents of arr[]

6 Answers   Hughes,


What is the use of putchar function?

0 Answers  


what is array?

8 Answers  


What is a pointer on a pointer in c programming language?

0 Answers  


Why do we use header files in c?

0 Answers  


#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?

1 Answers  


totally how much header files r in c language

8 Answers   TCS,


Categories