Question:
What is data structure, array, and struct? syntax of struct?
klaren_87
2007-01-18 21:10:02 UTC
What is data structure, array, and struct? syntax of struct?
Four answers:
neoiskiller
2007-01-18 22:00:52 UTC
Data structure - In computer science, a data structure is a way of storing data in a computer so that it can be used efficiently. Often a carefully chosen data structure will allow a more efficient algorithm to be used. The choice of the data structure often begins from the choice of an abstract data structure. A well-designed data structure allows a variety of critical operations to be performed, using as few resources, both execution time and memory space, as possible. Data structures are implemented using the data types, references and operations on them provided by a programming language.



Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to certain tasks. For example, B-trees are particularly well-suited for implementation of databases, while routing tables rely on networks of machines to function.



Array - In computer programming, a group of homogeneous elements of a specific data type is known as an array, one of the simplest data structures. An array is similar to, but different from, a vector or list (for one-dimensional arrays) or a matrix (for two-dimensional arrays). Arrays hold a sequence of data elements, usually of the same size and data type. Individual elements are accessed by their position in the array. The position is given by an index, which is also called a subscript. The index usually uses a consecutive range of integers, (as opposed to an associative array) but the index can have any ordinal set of values. Some arrays are multi-dimensional, meaning they are indexed by a fixed number of integers, for example by a tuple of four integers. Generally, one- and two-dimensional arrays are the most common.



Structure - A structure gathers together, diffrent atoms of information that comprise a given entity.

Explaining by taking an example -





Just as the entity we call a "book" is a collection of things such as title,author, call number,publisher,number of pages,date of publication etc. As one can see all this data is dissimilar,for example author is a string, wheras number of pages is integer.For dealing with such collections there is a data type called "structure".



Syntax of structure -



struct book

{

char name;

float price;

int pages;

};

struct book b1,b2,b3;



or



struct book

{

char name;

float price;

int pages;

}b1,b2,b3;
2007-01-18 21:21:13 UTC
Data Structure is usually a type of data: Text, Integers, Floating Point numbers, Logical, etc.



Array is usually a set of common data referenced with an index.

Name(1) = Bob

Name(2)=Goofy

Name(3)=Mickey



syntax of structure...go read your book and see what they are saying. Structure is usually a computer construct where differing data is grouped.



Address_Structure may contain

StreetNumber=10characters

StreetName=30 characters

City=20 characters

State=2 CHaracters

Zip=Integer
mcgray
2016-11-26 00:42:50 UTC
think it truly is not referred to as a "function" ? stands for structure in c programming language? celebration u intend to make various of files below one form. struct apple { int length; // how massive the apple is int coloration; // a million, pink, 2, diminished pink... etc }; u will only ought to declare it...
2007-01-18 21:13:22 UTC
You have to be way more specific, those words are used in dozens of contexts.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...