Q Define Data Structure? What are the different types of data structure?
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it
can be used efficiently.
Generally data structure are of two types.
I) Linear – Array, linked list, stack, queue etc.
and II) Non-linear – tree, graph etc.
Q What is the difference between local variables and global variables?
Global variables once declared they can be used any where in the program i.e. even in many functions. If
possible we can use the global variables in the different user defined header files.
On the other hand global variables values can be changed programmatically.
local variables are local to a functional and cant be used beyond that function. These variables only exist
inside the specific function that creates them. They are unknown to other functions and to the main program.
As such, they are normally implemented using a stack. Local variables cease to exist once the function that
created them is completed. They are recreated each time a function is executed or called.
No comments:
Post a Comment