Skip to main content

Posts

Showing posts from October, 2018

Golang Data Types

Data types:  Data types is defined as, it is an attribute that tells to the compiler or interpreter about the types of values.  In other words we can say that it defines, which type of value can be stored in Go variable.    In Go, data types are divided into four major category.  1. Basic types (number, string, bool)  2. Aggregate types (array, structs)  3. Reference types (pointer, slice, map, channels)  4. Interface types   Go basic types:  Following are the go basic types.  1. Number  2. String  3. Boolean   1. Number: It tells to the compiler that data is in integer type (like 20, 2.30 etc). Number further divided into different category. 1.1. integer 1.2. float 1.3. complex   1.1. Integer data type: Integer data type has different following types. 1.1.1. int - It stores both 32 and 64 bit signed integer, A 32 bit system allocate 32 bit of memory and a 64 bit system allocate 64 bit of memory. Hence 32bit system can store -2147483648 to 2147483647 and 64bit system c