Bifalgorithm post · Computer science one · Preprocessor Directives

What are preprocessor directives and why are standard libraries included?

What are preprocessor directives and why are standard libraries included? (Computer science one · Preprocessor Directives) — "The lines,\n\n1 #include \n\n2 #i…

Ideas in this flowchart

  • #include <stdlib.h> y #include <stdio.h> son directivas del preprocesador.
  • Las directivas del preprocesador modifican el código fuente antes de la compilación.
  • Estas líneas incluyen bibliotecas estándar para utilizar funciones ya implementadas.
  • stdlib.h representa la biblioteca estándar de C.
  • Aunque algunos compiladores la incluyen automáticamente, es recomendable incluirla explícitamente.
  • stdio.h representa la biblioteca estándar de entrada y salida.
  • stdio.h contiene funciones básicas de entrada y salida, incluida printf().
  • No incluir una biblioteca impide utilizar las funciones que proporciona.
  • Usar sus funciones sin incluirla puede provocar un error del compilador.
  • La extensión .h significa “header” o archivo de cabecera.
  • Los archivos de cabecera contienen declaraciones, mientras los archivos fuente contienen definiciones.
  • Esta convención se estudiará con más detalle al analizar las funciones en C.
Feed/

What are preprocessor directives and why are standard libraries included?

No cover

Channel

Computer science one

1 page

"The lines,\n\n1 #include <stdlib.h>\n\n2 #include <stdio.h>\n\nare preprocessor directives. Preprocessor directives are instructions to the compiler to modify the source code before it starts to compile it. These particular lines are “including” standard libraries of functions so that the program can use functionality that has already been implemented for us. The first, stdlib.h represents the C standard (std) library (lib). This library is so essential that many compilers will automatically include it even if you do not explicitly do so in your program. Still, it is best practice to include it in your code. The second, stdio.h is the standard (std) input/output (io) library which contains basic input/output (I/O) functions that we can use. In particular, the standard output function printf() is part of this library. Failure to include a library means that you will not be able to use the functions it provides in your program. Using the functions without including the library may result in a compiler error. The .h in the library names stands for “header”; function declarations are typically contained in a header file while their definitions are placed in a source file of the same name. We’ll explore this convention in detail when we look at functions in C (Chapter 18)."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.