answersLogoWhite

0


Best Answer

If you are talking about procedural languages like C, then you have two options:

Declaring global variables. These can be declared in header files, which are #included in source files to gain access to the shared data variable. Another way is to define a variable in a source file, then declare it extern in the other source files that use this variable. Note that the use of global variables is risky and generally frowned-upon.

Passing variables as function arguments. Some languages make a distinction between passing by value vs by reference. In C, everything is passed by value, even the arrays you pass are passed by value (the passed value is a pointer to the zero-th element of the array).

There are other ways of course, like using shared external files (especially if the data is shared between different processes, or multiple instances of the same process), shared memory, and semaphores (which are collectively known as IPC - InterProcess Communication).

User Avatar

Sharad Jha

Lvl 2
2y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

In procedure oriented programs, data is either global or local. Global data is accessible to any function, however this makes it extremely difficult to keep track of when and where changes are occurring. As a result, functions that operate upon the data must test the data to ensure the data is still in a valid sate. This is usually done upon entry to the function. However, in multi-threaded applications, global data can be changed at any time, and this can lead to data races when two or more threads attempt to access the same data at the same time where at least one of those threads is writing the data.

Local data is easier to keep track of because only the function in which the data is declared has access to that data. The data can still be passed to other functions, however the programmer has more control over which functions gain access. The downside of local data is that passing data between functions can have a significant runtime cost, particularly when the data is being passed to and from those functions by value rather than by reference.

Object oriented programs address these problems by encapsulating data and the functions that specifically operate upon them. Class allow programmers to define a set of data and functions as a data type. Private members of the class are only accessible to the class and its friends, protected members are also accessible to derived classes and their friends and public members are accessible to all code. This allows the programmer fine-grained control over which functions can actually access the data, vastly reducing the number of runtime-checks necessary to ensure the data remains in a valid state.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Stack memory

This answer is:
User Avatar

User Avatar

Anonymous

Lvl 1
4y ago

In procedure oriented programming a number of function s are written to accomplish these tasks. Here , data items are placed as global so that they are accessed by all the functions . Each function may have its own data. Global data are more vulnerable to an inadvertent change by a function.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Describe how data is shared by functions in a procedure oriented programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

The main emphasis of procedure-oriented is on algorithms rather than on data?

the main emphasis of procedure oriented programming is on algorithms rather than on data


What is the difference between procedure-oriented and problem-oriented in C language?

C is neither procedure-oriented nor problem-oriented. C is a structured, general purpose programming language. Procedure-oriented programs are distinct in that code jumps around -- a lot. They do not have structured loops nor do they have procedure calls (subroutines, functions or procedures), but they do make prevalent use of jump or goto statements. As a result, procedure-oriented programs are often called "spaghetti code" due to the difficulty in both reading and maintaining the program. Machine code and assembly language are both examples of procedure-oriented languages. Although you could theoretically write a C program using nothing but procedural programming methods, the resultant spaghetti code will be extremely difficult to read and maintain. Imagine if you couldn't use for(), while() and do..while() loops, and couldn't call any functions, not even the built-in functions. You would basically have nothing more than a single main() function with all code contained therein. Even multiple statements enclosed in braces would not be permitted in procedural-programming. Problem-oriented programming languages are languages tailored to a particular application. Although it is possible to create a problem-oriented language within C, as a superset of C for instance, C itself is general purpose.


What does object oriented and procedural mean in programming language?

procedure oriented means program will be execte in step by step procedure,when comes to object oriented means every thin can be represents the object a step[ step procedure doesnot follow


How you describe operations of stack ADT using c template functions?

No, because C does not support the concept of template functions. Template functions only exist in C++, never in C.


What is problem oriented language?

a program generation activity aims at automatic generation of a program.The source language is a specification language of an application doamain and the target language is typically a procedure oriented programming language.A program execution activity organized the execution of a program return in a programming language on a computer system.Its source language could be a procedure oriented language or a problem oriented language

Related questions

What is the difference between structured oriented programming procedure and oriented programming?

LOTTA


How is it different from the procedure-oriented programming?

How is what different... Please restate the question.


The main emphasis of procedure-oriented is on algorithms rather than on data?

the main emphasis of procedure oriented programming is on algorithms rather than on data


What is the difference between procedure-oriented and problem-oriented in C language?

C is neither procedure-oriented nor problem-oriented. C is a structured, general purpose programming language. Procedure-oriented programs are distinct in that code jumps around -- a lot. They do not have structured loops nor do they have procedure calls (subroutines, functions or procedures), but they do make prevalent use of jump or goto statements. As a result, procedure-oriented programs are often called "spaghetti code" due to the difficulty in both reading and maintaining the program. Machine code and assembly language are both examples of procedure-oriented languages. Although you could theoretically write a C program using nothing but procedural programming methods, the resultant spaghetti code will be extremely difficult to read and maintain. Imagine if you couldn't use for(), while() and do..while() loops, and couldn't call any functions, not even the built-in functions. You would basically have nothing more than a single main() function with all code contained therein. Even multiple statements enclosed in braces would not be permitted in procedural-programming. Problem-oriented programming languages are languages tailored to a particular application. Although it is possible to create a problem-oriented language within C, as a superset of C for instance, C itself is general purpose.


What does object oriented and procedural mean in programming language?

procedure oriented means program will be execte in step by step procedure,when comes to object oriented means every thin can be represents the object a step[ step procedure doesnot follow


What do you mean by procedure oriented programming?

A list of instructions telling a computer, step by step, what to do.


What is the different between c and c plusplus?

C is a procedure oriented programming and C++ is a object oriented programming.C++ is a superset of C.


What is first procedure oriented language?

The first procedure-oriented programming language is considered to be Fortran (short for Formula Translation). It was developed by IBM in the 1950s for scientific and engineering computations.


What kind of language is C programming?

C is a general purpose, procedure oriented (procedural) programming language developed by Dennis Ritchie in 1972.


How you describe operations of stack ADT using c template functions?

No, because C does not support the concept of template functions. Template functions only exist in C++, never in C.


What does an object message correspond to in non-Object oriented programming terms?

A call to a procedure from your main routine.


Advantages of procedure oriented programming?

The ability to reuse the same code at different places in the program with out coping it.