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

How to calculate Total working time using Login and logout?

2 Answers   CTS, Cygnus, Infosys, Signal Networks, TCS, Wipro,


Differentiate between new and malloc(), delete and free() ?

0 Answers   iNautix,


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

0 Answers  


write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101)

1 Answers   Bosch, College School Exams Tests,


can you change name of main()?how?

3 Answers   HCL, Siemens,






WHOT IS CHAR?

4 Answers   TCS,


Why isnt there a numbered, multi-level break statement to break out

0 Answers  


Is there a built-in function in C that can be used for sorting data?

0 Answers  


Is an array parameter is always "by reference" ?

1 Answers  


write a program to remove duplicate from an ordered char array? in c

2 Answers  


How can I find out the size of a file, prior to reading it in?

0 Answers  


What is your stream meaning?

0 Answers  


Categories