일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- Linear Regression
- regression
- 비선형 함수
- 회귀
- local minimum
- Nonlinear Model
- inheritance
- struct
- 지도학습
- MapReduce
- kubernetes
- 비선형모델
- member function
- 딥러닝
- Class
- 회귀학습
- Nonlinear Function
- Overloading
- call by value
- Effective C++
- 맵리듀스
- least square
- virtual function
- 선형모델
- 머신러닝
- Machine learning
- overriding
- call by reference
- c++
- 최소제곱법
- Today
- Total
J's Study log
[C] Data Type 본문
Data type in C
integer types
Type | Storage size | Value range |
char | 1 byte | -128 to 127 or 0 to 255 |
unsigned char | 1 byte | 0 to 255 |
signed char | 1 byte | -128 to 127 |
int | 2 or 4 bytes | -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 |
unsigned int | 2 or 4 bytes | 0 to 65,535 or 0 to 4,294,967,295 |
short | 2 bytes | -32,768 to 32,767 |
unsigned short | 2 bytes | 0 to 65,535 |
long | 8 bytes | -9223372036854775808 to 9223372036854775807 |
unsigned long | 8 bytes | 0 to 18446744073709551615 |
'limits.h' have data of limit numbers of inter types.
INT_MAX, INT_MIN
USHRT_MAX, USHRT_MIN ect.
float types
Type | Storage size | Value range | Precision |
float | 4 byte | 1.2E-38 to 3.4E+38 | 6 decimal places |
double | 8 byte | 2.3E-308 to 1.7E+308 | 15 decimal places |
long double | 10 byte | 3.4E-4932 to 1.1E+4932 | 19 decimal places |
void types
Types and Description |
Function returns as void There are various functions in C which do not return any value or you can say they return void. A function with no return value has the return type as void. For example, void exit (int status); |
Function arguments as void There are various functions in C which do not accept any parameter. A function with no parameter can accept a void. For example, int rand(void); |
Pointers to void A pointer of type void * represents the address of an object, but not its type. For example, a memory allocation function void *malloc( size_t size ); returns a pointer to void which can be casted to any data type. |
typedef
'typedef' is a reserved keyword in the C and C++ programming languages. It is used to create an alias name for another data type.
1
2
|
typedef unsigned int ui;
ui a; // same as 'unsigned int a;'
|
type casting
· (type) variable
· (type) value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <stdio.h>
int main()
{
int num1 = 32;
int num2 = 6;
float num3;
num3 = num1 / num2; // Compile error occurs
printf("%f\n", num3); // 5.000000
num3 = (float)num1 / num2; // cast 'num1' to float type
printf("%f\n", num3); // 5.333333
return 0;
}
|
s |
'Computer Language > C' 카테고리의 다른 글
[C] Structure Pointer (0) | 2020.02.08 |
---|---|
[C] Integer (0) | 2019.12.01 |
[C] Format specifier (0) | 2019.12.01 |
[C] Operator Priority (0) | 2019.12.01 |
[C] Functions (0) | 2019.12.01 |