What's the difference between struct x1 { ... }; and
typedef struct { ... } x2; ?

Answers were Sorted based on User's Feedback



What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ? ..

Answer / vikraman85

In the first its simply structure,by declaring structure
variable accessors we can access those elements inside the
structure..
eg.struct x1 a,b,c;
In the next one the x2 acts as a datatype..
b'coz of the typedef function..
we can use x2 as datatype for the further calculations like
int,float which are predefined datatypes,but this is
manually defined datatype..

Is This Answer Correct ?    16 Yes 3 No

What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ? ..

Answer / guest

The first structure is named by a tag, the second by a typedef
name.

Is This Answer Correct ?    4 Yes 2 No

What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ? ..

Answer / esperto informatico

in theory, for my opiniol the difference is connected to
the use of memory.... the correct and easy answer it could
be that the first define a struct and a second define a
struct type.... =).....

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

What does %f mean c?

1 Answers  


prototype of sine function.

2 Answers   Cadence,


What are the average number of comparisons required to sort 3 elements?

2 Answers   DRDO,


Sir i want e-notes of C languge of BAlaguruswami book i.e scanned or pdf file of balaguruswamy book on c language.PLEASE SEND ME on my mail id ajit_kolhe@rediff.com

8 Answers  


what is the difference between const volatile int i & volatile const int j;

2 Answers   HCL,


Is there any book to know about Basics of C Language?

4 Answers  


explain how do you use macro?

0 Answers  


why programs in c are running with out #include<stdio.h>? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

0 Answers  


Explain what are linked list?

0 Answers  


related to rdbms query .

2 Answers  


Can the size of an array be declared at runtime?

0 Answers  


Is that possible to add pointers to each other?

0 Answers  


Categories