difference between function & structure

Answer Posted / vignesh1988i

1st :
FUNCTIONS :
these are derived data types
STRUCTURES :
these are user defined datatypes

2nd :
FUNCTIONS :
function returns a value
STRUCTURES :
structures is not a function but only a datatype which returns no value.

3rd :
FUNCTIONS :
function does not have a provision of self referencial pointers.
STRUCTURES :
in this we can make one data member as a pointer to the same structure. that is self referencial structures.

4th :
FUNCTIONS :
function s consists of formal as well as actual arguments.
STRUCTURES :
here structures is a special datatype which holds all the possible form of data (i.e) int, char,float,double ,in combination s.

5th :
FUNCTIONS :
functions are reusable anytime and anywhere in the program, whenever we wann to re-use the code again we can simply call the function.
STRUCTURES :
but in structures we can do as above,we must access the data using '.' or when comes to pointers we must access through '->' operator



this are the statements that to my knowledge can said as difference... BUT STRUCTURES CANNOT BE COMPARED WITH FUNCTION SINCE, TWO ARE INDEPENDENT TO EACH OTHER.

THANK U

Is This Answer Correct ?    78 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the difference between functions abs() and fabs()?

828


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2094


I need a sort of an approximate strcmp routine?

830


When should a type cast be used?

764


How can I invoke another program or command and trap its output?

844


How can I handle floating-point exceptions gracefully?

866


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3555


why wipro wase

2037


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2063


Write a program to reverse a linked list in c.

845


Differentiate between full, complete & perfect binary trees.

850


Why do we use return in c?

742


Is this program statement valid? INT = 10.50;

893


‎How to define structures? · ‎

834


Explain do array subscripts always start with zero?

937