Basics of C Programming Language Flashcards
What are the 3 general steps in creating an executable?
- Preprocessing
- Compiling
- Linking
What is preprocessing?
Before code is compiled it is given to a program called the preprocessor. The preprocessor edits and manipulates code, setting it up for the compiler. Typically the preprocessor looks for lines that begin with # and alters the code based on these directives.
What is compiling?
Preprocessed code is given to the compiler, a program that translates C statements into machine instructions.
What is linking?
A linker combines the object code produced by the compiler with any additional code needed to create a complete execuatable. This additional code includes things like library functions.
What are the three fundamental language features that C relies on?
- Directives
- Fucntions
- Statements
What is a function?
A series of statements grouped together and given a name
What does main return?
An integer status code
What is a statement?
A command to be executed when the program runs.
Definition: String literal
A sequence of characters surrounded by “”
What are the valid ways to write comments in C?
/* this is the only valid comment */
some compilers allow // but it is not part of standard C
Definition: variable
A data storage location
What is a variable’s type?
A specification of what type of data it will hold
Definition: expression
a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces (returns, in a stateful environment) another value.
True/False: An expression of the same type can be substituted wherever a value is needed.
True
Definition: format string
A string literal which specifies a method for rendering an arbitrary number of varied data type parameter(s) into a string
Definition: constant
A value that doesn’t change during execution
Definition: Identifier
A symbol that represents an entity such as variables, functions, and macros.
Definition: token
A group of characters that can’t be broken up without changing their meaning
Definition: conversion specification
A placeholder, preceded by a %, representing a value to be filled in during printed. The value following the % specifies how the value is convereted from internal form to printed form
What forms can a conversion specification have? What do the values mean?
%m.pX or %-m.pX m: minimum field width p: precision X: conversion specifier -: left align
What does p specify when used with %m.pd?
What if p is bigger than the length of the value to be printed?
Minimum number of digits. Output is zero-filled
What is the conversion specifier: d
decimal integer
What is the conversion specifier: e
floating point in exponential form
What does p indicate in %m.pe? What if p == 0?
How many digits appear after the decimal. The decimal is not displayed