answersLogoWhite

0


Best Answer

Data structure is nothing but a way to organize and

manipulate any given set of data in a specific and reusable

format/structure hence simplifying the manipulation of data.

Some of the commonly and frequently used data structures

are Stack, Queue, List, Set, e.t.c. But this list is not

limited to what we see here, rather we can invent our own

as long as there is a definite structure and better

efficiency by using it than work with raw data.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

5y ago

A data structure (struct) in C++ is a class that has public member access by default. Typically we use a struct to define "plain old data" (POD); a public access class which has no member functions and trivial construction. A POD is equivalent to a struct in C and is typically used to provide backward compatibility with C code.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Arrays are only of importance when dealing with static arrays. For dynamic arrays, it is easier and more efficient to use a vector rather than a C-style dynamic array, because memory management can be handled transparently.

Static arrays and dynamic vectors are most useful when dealing with two or more related data elements of the same type where constant-time random access is essential.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

C++ does not have a data structure as such. In C we would use the struct keyword to define a data structure, but in C++ the struct keyword declares a class (but does not necessarily define it). The only real difference between a class and a struct in C++ is that struct members are public by default and base class inheritance defaults to public. As such there is no practical difference between the following declarations:

struct struct_t {

// ...

};

class class_t {

public:

// ...

};

The closest we can get to a C-style data structure is when a class represents a POD (plain old data) data type. The following is an example of a POD data type:

struct point_t {

public: // always specify the access type, even when it is the default access

int x;

int y;

};

Note that this is very similar to a C-style struct. However, unlike a C-style struct, PODs also have a compiler-generated default constructor, copy constructor and default assignment operator. In other words, the explicit declaration for point_t would be as follows:

struct point_t {

public:

int x;

int y;

point_t () x(0), y(0) {}

point_t (const point_t& copy) x(copy.x), y(copy.y) {}

point_t& operator= (const point_t& rhs) { x = rhs.x; y = rhs.y; return *this; }

};

Despite the difference, a POD can still be passed to functions in other programs written in C where they will be treated just as if they were a data structure. Likewise, C++ programs can work with data structures generated by C programs. This is provided both programs use covariant data types of course (data types that are intrinsically the same).

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

The C++ struct and class keywords are exactly the same; they are both used to declare classes. The only practical difference is that struct data types default to public access and public visibility mode while class data types default to private access and private visibility mode. This allows C++ to interact with C struct data types just as if they were C++ classes declared with a compiler-generated default constructor, copy constructor and assignment operator.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

C++ is a very strong and efficient programming language. Its flexibility and efficiency comes from its object-oriented aspects, which allows you to represent anything as a software object. No matter what anyone tells you, object-oriented programming is not for people who do not know how to program. In fact, it IS for people who know how to program. It is quicker and more efficient to program with an object-oriented language such as C++ than a procedural language such as C. Data structures in C++ are represented by classes. Classes are also used in its predecessor C, but C++ revolutionized the programming world by making classes make objects. So in conclusion, if you want to make fast, reliable, and efficient programs, C++ is just the language for you. You can make everything from general applications, to games and even operating systems (with a little bit of inline assembly).

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

A data structure (in C, and in most other programming languages) is an ordered collection of data items, where each item (often called field or element) has its individual semantics and type, while all elements combined have joint semantics. The combined data type is the type of the structure.

For example, a simple student management program may record each students first name, family name, date of birth and the student ID number. These aspects could be managed with a data structure containing four elements: the firstName and familyName elements containing strings (or pointers to characters in C), the studentId element containing an unsigned long number, and the date of birth element, itself being implemented with a data structure of three unsigned short fields, day, month and year:

typedef struct {

char* firstName;

char* familyName;

unsigned long studentId;

struct {

unsigned short day;

unsigned short month;

unsigned short year; } dateOfBirth;

} StudentRecord;

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

C++ (C Plus Plus) is a high-level programming language, where a Data Structure is a way of organising and storing data so that it can used and manipulated quickly.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is difference between c plus plus and data structures?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is file structures in C plus plus?

As far as C++ is concerned files do not have structures, they are simply raw data streams. It's entirely down to the programmer to determine what structures exist within the file and to interpret the data accordingly. C++ cannot do it for you.


What has the author Yedidyah Langsam written?

Yedidyah Langsam has written: 'Data structures using Cand C[plus plus]' -- subject(s): C (Computer program language), Data structures (Computer science)


How can i downlaod free 'Data structures using c plus plus' by DS malik?

Sorry, I do not support piracy


What is the difference between automatons and kripke structures?

They are veery similar - instead of atomic propositions automatons have letters and they appear on the edges rather than in the states. Plus automatons have accepting states which kripke structures don't.


What is the difference between class data type and basic type in c plus plus .How can someone know which one is class type and which one is basic type.?

Basic types (primitive data types) have no methods associated with them.


What is difference between '1' and 1 as for us a computer is concerned with respect to c plus plus?

When you type '1' in a C++ program, it is considered to be of character data type(char). When you type 1, it is considered to be of integer data type.


What is the difference between private stafford and plus student loans?

What is the difference between private stafford and plus student loans?


Defference between c plus plus and c?

these are difference in between c and c++: a) C is a SPL and C++ is a OOP. b) C has not concept of object but C++ has this feature. c) C has not 'class' name data type but C++ has.


What is the difference between pointers in c and c plus plus?

Nothing.


What is the difference between be plus ing and get plus ing?

There are no such terms in C++.


What is the difference between statements in c plus plus charconstp and char constp?

There is no difference. Both statements are invalid.


What is the difference between Nike plus and Nike plus Active?

They have different names