CMPE - L3

Cards (77)

  • Character set
    is a set of alphabets, letters and some special characters that are valid in C language.
  • Alphabets
    C accepts both lowercase and uppercase alphabets as variables and functions
  • Digits
    0123456789
  • Special Characters
  • White space Characters
    blank space, new line, horizontal tab, carriage return and form feed
  • C Keywords
    Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.
  • keywords in c language
    • auto
    • break
    • case
    • char
    • continue
    • do
    • default
    • const
    • double
    • else
    • enum
    • extern
    • for
    • if
    • goto
    • float
    • int
    • long
    • register
    • return
    • signed
    • static
    • sizeof
    • short
    • struct
    • switch
    • typedef
  • keywords in c language
    union
    void
    while
    volatile
    unsigned
  • C identifiers
    It refers to name given to entities such as variables, functions, structures etc.
  • Identifier
    must be unique. They are created to give unique name to a entity to identify it during the execution of the program.
  • Rules for writing an identifier
    1. A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores.
    2. The first letter of an identifier should be either a letter or an underscore. However, it is discouraged to start an identifier name with an underscore.
    3. There is no rule on length of an identifier. However, the first 31 characters of identifiers are discriminated by the compiler
  • Variables
    a variable is a container (storage area) to hold data.
  • Rules for naming a variable in C
    1. A variable name can have letters (both uppercase and lowercase letters), digits and underscore only.
    2. The first letter of a variable should be either a letter or an underscore. However, it is discouraged to start variable name with an underscore. It is because variable name that starts with an underscore can conflict with system name and may cause error.
    3. There is no rule on how long a variable can be. However, only the first 31 characters of a variable are checked by the compiler. So, the first 31 letters of two variables in a program should be different
  • constant
    is a value or an identifier whose value cannot be altered in a program.
  • Integer constants
    An integer constant is a numeric constant (associated with number) without any fractional or exponential part.
  • There are three types of integer constants in C programming:
    •decimal constant(base 10)
    •octal constant(base 8)
    •hexadecimal constant(base 16)
  • In C programming, octal constant starts with a 0 and hexadecimal constant starts with a 0x.
  • Floating-point constants
    is a numeric constant that has either a fractional form or an exponent form.
  • Character constants
    A character constant is a constant which uses single quotation around characters.
  • Escape Sequences
    The backslash (\) causes "escape" from the normal way the characters are interpreted by the compiler.
  • backspace
    \b
  • \f
    form feed
  • \n
    newline
  • \r
    return
  • \t
    horizontal tab
  • \v
    vertical tab
  • \\
    backslash
  • \'
    single quotation mark
  • \"
    double quotation mark
  • \?
    question mark
  • \0
    null character
  • String constants
    String constants are the constants which are enclosed in a pair of double-quote marks.
  • //string constant
    "good"
  • null string constant
    ""
  • string constant of six white space
    " "
  • "x"
    string constant having single character
  • Enumeration constants
    define enumeration types
  • Fundamental Types
    • Integer
    • Floating
    • Character
  • Derived Typess
    • Arrays
    • Pointers
    • Structures
    • Enums
  • int - Integer data types
    whole numbers that can have both positive and negative values but no decimal values.