Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 6. Character String Types It is one in which the values consists of sequences of characters. How to Define a variable contain a string? In a programming.

Similar presentations


Presentation on theme: "Chapter 6. Character String Types It is one in which the values consists of sequences of characters. How to Define a variable contain a string? In a programming."— Presentation transcript:

1 Chapter 6

2 Character String Types It is one in which the values consists of sequences of characters. How to Define a variable contain a string? In a programming language if strings are not defined as primitive type, then string type is usually stored in arrays of characters and referenced. In c++: char *str = “my name is abdulwahab”

3 User-defined Ordinal Types It is one in which the range of possible values can be easily associated with the set of positive integers. – Enumeration Type: It is one in which all of possible values which are named constants are provided in the definition. In c++: enum days { sat, sun, mon, tues, wed, thurs, fri }; days bd = tues ;

4 Arrays Types How to define an array and initilize: Type array_name [ ] = values ; int list_number [ ] = { 1, 20, 58, 64}; char first_name = “abdulwahab” ; char *names [ ] = {“ali”, “mohammed”, “sami”};

5 Record Types A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures are declared in C++ using the following syntax: struct structure_name { member_type1 member_name1; member_type2 member_name2; member_type3 member_name3; } object_names;

6 Record Types Example struct structure_name { member_type1 member_name1; member_type2 member_name2; member_type3 member_name3; } object_names; Struct person{ char fname [20] ; int age; float weight ; int id; } human;


Download ppt "Chapter 6. Character String Types It is one in which the values consists of sequences of characters. How to Define a variable contain a string? In a programming."

Similar presentations


Ads by Google