본문 바로가기
Basic C Language

#2. Variable

by Srff5123 2023. 4. 5.
728x90

#include <stdio.h>

/*
    Variable(변수)
    - 변할 수 있는 데이터

    Constant(상수)
    - 변하지 않는 데이터
*/

int main()
{
    // Datatype name; 
    int a; //declaration , int(정수형) a 라는 변수 선언
    a = 10; //initialize  a = 10 으로 값 설정

    printf("%d\n", a); // %d(정수형)에 a의 값 10을 넣어서 출력 

    a = 11; // a는 11로 재정의
    printf("%d\n", a);

    int b = 20;
    printf("%d\n", b);

    b = 30;

    int result; // result 정수형 변수이름 선언
    result = a + b; // result에 a와 b를 더해준 값을 저장
    printf("결과 : %d\n", result);

    //변수 표기법

    //헝가리안 표기법
    int i_age;
    int intWeight;

    int hpCount;   //카멜 표기법
    int HpCount;   //파스칼 표기법
    int hp_count;   //스네이크 표기법

    int a1;
    //int 1a;

    //int hello world;
    //int int;
    //int for


    return 0;
}

728x90

'Basic C Language' 카테고리의 다른 글

#6. If (조건문)  (0) 2023.04.12
#5. Type_Casting  (0) 2023.04.05
#4. DataType  (0) 2023.04.05
#3. Operation(연산자)  (0) 2023.04.05
#1. Hello World  (0) 2023.04.05