Category:C

From ElectroDragon Wiki
Revision as of 18:44, 19 May 2021 by Chao (talk | contribs) (→‎Data Type)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Basic

typedef
C 语言提供了 typedef 关键字,您可以使用它来为类型取一个新的名字。下面的实例为单字节数字定义了一个术语 BYTE:

typedef unsigned char BYTE;

Operator
Pointer
Struct

Language

Compiler

  • Linux GCC
  • HI-TECH PICC for PIC

Declaration

Data Format

From to function example description reference
String char toCharArray sensorVal.toCharArray(sensorPrintout, 4); TFT
float string dtostrf dtostrf(f_volt, 6, 2, volt_char); f_volt is float value
Example Example Example
  • printf
  • String aaa = String(bbb) // bbb is char array

Header file Definition

Define macro

For examples set pins for segment display, file seg.h

  • Further refer to SFR_Macro.h in BSP of nuvoton
#define set_a      P05 = 1
#define set_b      P03 = 1
#define set_c      P10 = 1
#define set_d      P01 = 1
#define set_e      P07 = 1
#define set_f      P02 = 1
#define set_g      P14 = 1
#define set_dot    P00 = 1

Define type

typedef bit                   BIT;
typedef unsigned char         UINT8;
typedef unsigned int          UINT16;
typedef unsigned long         UINT32;

typedef unsigned char         uint8_t;
typedef unsigned int          uint16_t;
typedef unsigned long         uint32_t;

Complier

Reference

Subcategories

This category has the following 9 subcategories, out of 9 total.

Pages in category "C"

The following 13 pages are in this category, out of 13 total.