1 / 11

Datatypes in C

Datatypes are a very fundamental and important part of any programming language. This ppt will give a clear understanding of datatypes in C .

Anushka6
Download Presentation

Datatypes in C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DATATYPES IN

  2. Overview • Introduction to C++ • What are datatypes • Datatypes in C++ : • Primary • Derived • User-defined • Conclusion

  3. Introduction to C++ C++ is a general-purpose programming language and is widely used nowadays for competitive programming. It was developed to enhance the C language with object-oriented programming. Features of C++: • It is an object-oriented programming language • It is a mid-level language. • It is a machine independent but platform-dependent language • It has a rich library support • It has a high speed of execution. There is no official documentation for C++ available, however the closest available document is the C++ Core Guidelines.

  4. What are Datatypes? To define datatypes we first need to know what are variables and its types. • VARIABLE - A variable is a named unit of data that is assigned a value. • DATATYPE - A data type is a classification that restricts what a variable or object can hold in computer programming. They specify the size and type of the value to be stored in the variable. In the given image ‘int’ and ‘char’ are the datatypes whereas ‘item1’ and ‘item2’ are variables.

  5. Datatypes in C++ C++ supports a variety of datatypes and the developer can choose the datatype according to its needs. They can be broadly classified into three categories: Primitive, Derived and User Defined • Int • Char • Double • Boolean • Void • Function • Array • Pointer • Reference • Class • Structure • Union • Enum

  6. Primitive Datatypes These datatypes are built-in or predefined in the language itself. They can directly be used to declare the variables. Primitive datatypes are of the following types: • Integer • Character • Boolean • Floating Point • Double Floating Point • Void or Valueless • Wide Character The sizeof() operator is used to find out the number of bytes occupied by the datatype in the memory.

  7. This code demonstrates the use to sizeof operator to find the memory occupied by a primitive datatype in your computer The output of the previous code. Results may vary from machine to machine

  8. Derived Datatypes These are datatypes which have been derived from built-in datatypes. Primarily they are of the following types: • Function • Array • Pointer • Reference The above code demonstrates the use of derived data types – arrays, function and pointers.

  9. User Defined Datatypes These datatypes are defined by the users themselves. These datatypes generally contain a combination of many primitive and derived datatypes. Primarily they are of the following types: • Class • Structure • Union • Enum The above code demonstrates the use of user defined data types – structures

  10. Conclusion When writing a program, a programmer must properly define event and entity properties and for that they must have to have a good understanding of data types. Application of knowledge on datatypes is not limited to data collection or instrumentation; other activities such as data management, data integration, and internal application development (using no-code or low-code tools) also require proper knowledge of datatypes.

  11. THANK YOU https://www.cetpainfotech.com/ 9212172602 QUERY@CETPAINFOTECH.COM

More Related