answersLogoWhite

0

When structures are passed as arguments to functions, the entire structure is typically pushed on the stack, using as many words as are required. (Programmers often choose to use pointers to structures instead, precisely to avoid this overhead.) Some compilers merely pass a pointer to the structure, though they may have to make a local copy to preserve pass-by-value semantics. Structures are often returned from functions in a location pointed to by an extra, compiler-supplied ``hidden'' argument to the function. Some older compilers used a special, static location for structure returns, although this made structure-valued functions non-reentrant, which ANSI C disallows

User Avatar

Wiki User

17y ago

What else can I help you with?

Continue Learning about Engineering

Pass a structure to functions?

Passing Structure to a function:type specifier function-name (structure-variable);


Which is the syntax used for passing a structure member as an argument to a function?

You can pass the address by using '&' with the pointer variable, while passing actual arguments. In formal arguments '*' is used in the place of '&'. To pass the address of a pointer variable a double pointer variable should be used .


What is the difference between passing an array and passing single value data to a function?

Passing a single value to a function is often just a simple integer. But passing an array, character string or other data structure is typically "pass by reference", or in other words, the calling statement will 'point to' the place in memory where the data structure resides.When a function is called using a pointer to a data structure, both the calling environment and the called function are referencing the same data; any changes made to the data in the structure by the function will have changed the data that the original calling environment sees.However, when a value is passed to a function, the function creates it's own copy of the value, and can change it in any way without changing the original value.


Why the functions of java is called methods?

because it is capable of taking parameters, passing or returning values as in c++. it has it's own identity as return type, and signature of the method body. It can also be overloaded as well.


What are the limitations of return statement in c language?

The only limitation is that the object returned from a function must be returned by value. We may return a pointer (by value) in order to return complex objects more efficiently, however the pointer must not refer to a non-static local object because non-static local objects fall from scope as soon as the function returns. In C++ we do not have this problem because objects can be implemented with efficient move semantics, thus passing by value becomes an efficient means of returning complex objects from functions, including non-static local objects.

Related Questions

Pass a structure to functions?

Passing Structure to a function:type specifier function-name (structure-variable);


What is the name of a structure for passing smoke?

Chimney.


What do you call the process of testing flow of control between a main function and its subordinate function?

function-call and returning (actually, it is 'passing', not 'testing')


Food enters the stomach by passing through a muscular structure at the end of the esophagus called?

The cardiac sphincter.


Which is the syntax used for passing a structure member as an argument to a function?

You can pass the address by using '&' with the pointer variable, while passing actual arguments. In formal arguments '*' is used in the place of '&'. To pass the address of a pointer variable a double pointer variable should be used .


What is the cell structure that does not allow any food to enter a cell?

The cell membrane allows the passing of some substances.


Object-oriented software is another name for structured software?

Object-oriented programming is a more recent subset of structured programming. Structured programming emphasized the need to align data structures with program structure, a concept that is formalized and carried much further in object-oriented programming. However, structured programming advocated hierarchical constraints on program structure that are incompatible with the event-driven, message-passing software architectures commonly implemented in the object-oriented style, today.


What is the difference between passing an array and passing single value data to a function?

Passing a single value to a function is often just a simple integer. But passing an array, character string or other data structure is typically "pass by reference", or in other words, the calling statement will 'point to' the place in memory where the data structure resides.When a function is called using a pointer to a data structure, both the calling environment and the called function are referencing the same data; any changes made to the data in the structure by the function will have changed the data that the original calling environment sees.However, when a value is passed to a function, the function creates it's own copy of the value, and can change it in any way without changing the original value.


Why the functions of java is called methods?

because it is capable of taking parameters, passing or returning values as in c++. it has it's own identity as return type, and signature of the method body. It can also be overloaded as well.


What are three specific feasible policies and programs should be developed and implemented by the government in order to effectively arrest this low percentage of passing the licensure exam for teach?

Percentage is so much more mephitic than it is low


What is a structure for passing smoke?

A structure for passing smoke usually involves a chimney or a ventilation system that allows smoke to travel out of a building safely. This helps prevent the accumulation of smoke indoors, which can be harmful to health and can also cause fire hazards. Proper design and maintenance of these structures are important for efficient smoke removal.


Which type of object blocks all light from passing through?

An opaque object blocks all light from passing through, as it does not allow light to pass through due to its composition and structure. Examples include wood, metal, and thick plastics.