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

i have a written test for microland please give me test pattern

0 Answers   Microland,


struct node { int *a; char *b; char array[12]; }; struct node m,*n; assign the value in *a,*b,char array[12]

3 Answers  


What is structure data type in c?

0 Answers  


Define function pointers?

1 Answers  


What is signed and unsigned?

0 Answers  


What is c token?

0 Answers  


Write a C program to find the smallest of three integers, without using any of the comparision operators.

7 Answers   TCS,


Program to find the sum of digits of a given number until the sum becomes a single digit

8 Answers   InterGraph,


Write a program to reverse a given number in c?

0 Answers  


What is c value paradox explain?

0 Answers  


What are loops in c?

0 Answers  


WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *

3 Answers   Infosys, TCS,


Categories