📜  C 和嵌入式 C 之间有什么区别?

📅  最后修改于: 2021-09-13 02:09:37             🧑  作者: Mango

C语言:
C 是一种通用编程语言,广泛用于设计任何类型的基于桌面的应用程序。它是由丹尼斯·里奇( Dennis Ritchie ) 开发的一种系统编程语言,用于开发操作系统。 C 语言的主要特点包括对内存的低级访问、一组简单的关键字和干净的风格,这些特点使 C 语言适用于操作系统或编译器开发等系统编程。本质上它采用原生平台开发方案,即它开发的应用程序是平台相关的,只能在单一平台上使用。

嵌入式 C:
Embedded C 是 C 语言的扩展,用于开发基于微控制器的应用程序。嵌入式C语言对普通C编程语言的扩展是I/O硬件寻址、定点算术运算、访问地址空间等。嵌入式C程序有五层基本结构。他们是:

  • 评论:这些是简单易读的文本,用代码编写,使用户更容易理解。通常注释写在///* */ 中
  • 预处理器指令:预处理器指令告诉编译器要查找哪些文件以查找程序中不存在的符号。
  • 全局声明:定义全局变量的代码部分。
  • 局部声明:定义局部变量的代码部分。
  • Main函数:每个 C 程序都有一个驱动整个代码的 main函数。它基本上分为声明部分和执行部分两部分。其中,声明部分是所有变量被声明的地方,执行部分定义了程序中的整个执行结构。

本质上它采用跨平台的开发方案,即由它开发的应用程序是平台无关的,可以在多个平台上使用。

C 和嵌入式 C 之间的差异:

Parameters C Embedded C
GENERAL
  • C is a general purpose programming language, which can be used to design any type of desktop based applications.
  • It is a type of high level language.
  • Embedded C is simply an extension C language and it is used to develop micro-controller based applications.
  • It is nothing but an extension of C.
DEPENDENCY
  • C language is hardware independent language.
  • C compilers are OS dependent.
  • Embedded C is fully hardware dependent language.
  • Embedded C are OS independent.
COMPILER
  • For C language, the standard compilers can be used to compile and execute the program.
  • Popular Compiler to execute a C language program are:
    • GCC (GNU Compiler collection)
    • Borland turbo C,
    • Intel C++
  • For Embedded C, a specific compilers that are able to generate particular hardware/micro-controller based output is used.
  • Popular Compiler to execute a Embedded C language program are:
    • Keil compiler
    • BiPOM ELECTRONIC
    • Green Hill software
USABILITY AND APPLICATION
  • C language has a free-format of program coding.
  • It is specifically used for desktop application.
  • Optimization is normal.
  • It is very easy to read and modify the C language.
  • Bug fixing are very easy in a C language program.
  • It supports other various programming languages during application.
  • Input can be given to the program while it is running.
  • Applications of C Program:
    • Logical programs
    • System software programs
  • Formatting depends upon the type of microprocessor that is used.
  • It is used for limited resources like RAM and ROM.
  • High level of optimization.
  • It is not easy to read and modify the Embedded C language.
  • Bug fixing is complicated in a Embedded C language program.
  • It supports only required processor of the application, and not the programming languages.
  • Only the pre-defined input can be given to the running program.
  • Applications of Embedded C Program:
    • DVD
    • TV
    • Digital camera
想要从精选的视频和练习题中学习,请查看C 基础到高级C 基础课程