C Programming: Can a structure return value?

In c data type structure is present ,structure allow to use different data type like int,char in the same program,my question is ,is structure return any value ?if it return any value what is the reason,if structure not return any value than what is the reason behind this.please reply
I am new member so i do not know any thing about crazy engineer.if i asked any thing wrong then please correct me.

Replies

  • gaurav.bhorkar
    gaurav.bhorkar
    Re: c language

    Welcome to CE, naina.

    Can you clarify your question?

    In C a structure is a collection if different data types. That is, we can have int, char, float or another structure as its members.

    And a structure does not return a value, a function returns a value. You can return a structure variable from a function, like any other variable.
  • Manish Goyal
    Manish Goyal
    Structure doesn't return anything it basically meant for user defined data types
  • sushant005
    sushant005
    Structure cannot return value since it is a user defined data type.

    It contains the collection of heterogenous data type means different data type like int,char,float evan arays and other structures
    and its only a logical concept.
  • elizas
    elizas
    I declared a variable as “int” data type for a PatientId. It worked fine in local, but when that code went to LIVE, the application gave exception because in LIVE PatientId is too long to accommodate in int data type.

    So before declaring any variable we need to consider all the situations, application scope, environment .Even one code may be working fine today, after 1/ 10/20 days/months/years it will fail due to just due to data type declaration mistake.

    Think more; write less is the policy for better programming.

    My Experience No 2:

    I declared a variable as int data type which was a placeholder for a result status (meaning, based on the result status that variable varies from 0/1/2/3. It can contain only these four values).

    “int” data type is 4 byte integer in C#. But I can declare this variable as “sbyte” which represents a 1 byte integer. Since that variable contains only 1 or 2 or 3 or 4, declaring the variable as “int” is wastage of memory space.

    Before declaring any variable we need to just think of the memory space needed for that variable, our requirement, any other good alternative for this variable.

    #-Link-Snipped-#

You are reading an archived discussion.

Related Posts

The oldest telecommunications used an operator sitting at a switchboard. You would lift the ear piece off the hook on your phone and then turn a crank. The crank was...
Here's our official review of book "Nothing Can Be As Crazy" by author Ajay Mohan Jain. The book is about curious ways of urban middle class life. Link: Book Review:...
Hi all! I am implementing a project about billard management using C# and SQL Server. I have problems in connecting database.For example, I want to insert, delete or update in...
hai friends i need some of the details about the online courses which are available free ware in internet.this course must help in my project work and also to enhance...
this is nice.i want to be a CEans😒