![]() If there is a requirement where you need to represent any physical world structure into the coding world, then this type could come in handy, like the class of students can be defined as a structure and student marks and student roll number can be used as variables inside it, an array can be introduced which could hold data related to such structure for many students. Let’s see a simple snippet to understand the declaration and use of arrays. When any homogenous set of data has to be stored in contiguous memory locations, then this data type is chosen, the use case is that there may be times when your code would return more than one result, and that has to be returned from functions cumulatively, like if we have to find a list of all months in a year, then they will be 12, hence we can’t place 12 months discretely in a single variable, so we use arrays for the same. The above snippets can be referred to as examples for the same. it won’t return anything like you saw the main function prefixed with void type in the above snippets), then you can mark it as void type. If you don’t want to assign any type to a function (i.e. Char TypeĬhar f = 65 // represents ASCII char value, refer to ASCII table This represents the character data type, and it can be either signed or unsigned with a constant size of 1 byte for both cases. Printf("max double value possible in negative range : %g\n", (double) -DBL_MAX) Printf("max double value possible in positive range : %g\n", (double) DBL_MAX) Printf("max float value allowed in negative range : %g\n", (float) -FLT_MAX) Printf("max float value allowed in positive range : %g\n", (float) FLT_MAX) Int TypeĪny real number can be stored in the float data type, and here also we can specify the range based on data type and size selection, a range of numbers is allowed. If you have to store the whole numbers, then int can be used as a data type, it can have a range of numbers based upon the size you choose in memory, and it can have either all positive or from negative to positive range of numbers based upon user choice of code design. Lets now describe all of them with examples: 1. The derived data types can be among the following:
0 Comments
Leave a Reply. |