durga
thanks! But what is wrong with "typedef struct sortElement sortElement;"
is it not same as saying take "struct sortElement" as sortElement
When we declare a struct as
struct structName {
//declaration of variables
};
The declaration of variable of the above type will look like:
struct structName xyz;
As per C syntax you can not declare a variable as "structNamexyz ;" because structName is currently not a data type "struct structName" is a data type.
'typedef' can be used to define a data type to avoid using 'struct' with 'structName' while you are declaring variables.
The typedef will look like:
typedef struct structName {
//variable declaration
} structName_t;
Here i have defined a data type structName_t of type "struct structName". Now you can use "structName_t" instead of "struct structName".
The declaration of variable using the newly defined data type can be done as:
structName_t xyz;
Let me know if any item need more clarification.
P.S.: For query on different topic start new thread.
-Pradeep