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

Is register a keyword in c?

0 Answers  


24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?

0 Answers  


write a program to convert a expression in polish notation (postfix) to inline (normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix

0 Answers  


Is there a way to switch on strings?

0 Answers  


write a c code "if you give a any decimal number then print that number in english alphabet"? ex: i/p: 552 o/p: five hundred fifty two ...

1 Answers   Philips,






What is %lu in c?

0 Answers  


What are all different types of pointers in c?

0 Answers  


Toggle nth bit in a given integer - num

5 Answers   Qualcomm,


write a c program to find the sum of five entered numbers using an array named number

0 Answers   TATA,


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

0 Answers  


Why enum is used in c?

0 Answers  


How many types of linked lists what are they? How many types of data structures?

18 Answers   BSNL, Pivotal Software,


Categories