当前位置:网站首页>C language learning

C language learning

2022-07-07 23:45:00 Assass1n-

C Language learning

1. Define constants

usage : #define Constant names value

const data type Constant names = value

2. integer int

Print format

Print format meaning
%d Output one A signed Decimal system of int type
%o( Letter o) Output 8 It's binary int type
%x Output 16 It's binary int type , Letters are output in lowercase
%X Output 16 It's binary int type , Output letters in uppercase
%u Output one 10 It's binary An unsigned number

Example

#include <stdio.h>
int main(void)
{
    
    // data type   identifier  = value 
    // Unsigned  unsigned  A signed  signed
    signed a =-10;
    //unsigned int a =10  This can be displayed normally   If =-10 when   There will be garbled code 
    printf("%d\n",a);// here  unsigned  It can output normally -10
    //printf("%u\n",a);
    return 0;
}
#include <stdio.h>
int main(void)
{
    
    int a=10;
    printf("%d\n",a);// Output 10
        printf("%x\n",a);// Output a
        printf("%X\n",a);// Output A
        printf("%o\n",a);// Output 12
    // Define octal data to 0 start 
    int b =0123;
     // Definition 16 Hexadecimal data   With 0x start 
        int c =0x123;
     printf("%x\n",b);
     printf("%X\n",b);
     printf("%o\n",b);
     printf("%x\n",c);
     printf("%X\n",c);
     printf("%o\n",c);
        return 0;
    
   
}
原网站

版权声明
本文为[Assass1n-]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207072115438950.html