• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/45

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

45 Cards in this Set

  • Front
  • Back

Funktion

En samling programsatser som "gör något"


Ett C-program börjar med main-funktionen, vilken kallas då exekvering startas.

getchar()

Väntar på att användaren ska trycka på Enter

return 0;

Returnerar ett värde till OS.


0 betyder att programmet lyckats

Preprocessor directives

A C program line beginning with # that provides an instruction to the preprocessor

Preprocessor

A system program that modifies a C program prior to its compilation

Library

A collection of useful functions and symbols that may be accessed by a program.


Not defined directly by C

#include

Gives a program access to a library

#define

Associates a constant macro with a constant value

Constant macro

A name that is replaced by a particular constant value before the program is sent to the compiler

Main function

Every C program has a main function


The body of the function is enclosed in braces

Declarations

The part of a program that tells the compiler the names of memory cells in a program

Executable statements

Program lines that are translated into machine language and later executed

Reserved word

A word that has special meaning in C

Standard identifiers

Have special meaning, such as printf and scanf.


Can be redefined, but cannot then be used for its original purpose.

User-defined identifiers

Can consist of letters, digits and underscores


Cannot begin with a digit


A reserved word cannot be used

Variable

A name associated with a memory cell whose value can change

Variable declarations

Statements that communicate to the compiler the names of variables in the program and the kind of information stored in each variable

Data type

A set of values and operations that can be performed on those values

Int

Integers.




Faster operations than doubles


Less storage space needed than doubles


Oparations are precise


Having unsigned variables increases their magnitude

Double

Real numbers (decimal point numbers)


Scientific notation: 1.23 * 10^5 written as 1.23e5 or 1.23E5


Round-off error may occur


Float is a smaller decimal point variable

Char

Represents an individual character value.


Enclosed in single quotes

ASCII Code

A particular code that specifies the integer representing each char value

Assignment statement

An instruction that stores a value or a computational result in a variable


= is the assignment operator

Input operation

An instruction that copies data from an input device to memory, e.g. scanf

Output operation

An instruction that displays information stored in memory, e.g. printf

Input/Output function

A C function that performs an input or output operation


Most common ons supplied through #include

the printf function

Function arguments include a format string with placeholders and a print list

Placeholders for char, int, and double

%c char.


%d int.


%f double (printf).


%lf double (scanf)

the scanf function

Takes function arguments including a format string and a print list including &-operators.

7.0/2.0

3.5

7/2

3 (only the integral part)

% modulus

Returns the remainder of the result of dividing the operands.

Mixed-type assignment

The expression is evaluated before the assignment is made

Type cast

Converting an expression to a different type by writing the desired type in parentheses in front of the expression

Unary operators

Take only one operand


Negation and plus

Binary operators

Require two operands


E.g. adding, subtracting

Rules for evaluating arithmetic expressions

1. Parentheses


2. Unary + -


3. *, /, %


4. Binary +, -




Binary operators at the same level are evaluated left to right.

Field width

The number of columns to use for the display of the value

Formatting doubles

%n.mf


n = field width


m = decimal places

Interactive mode

A mode of program execution in which the user responds to prompts by entering data

Batch mode

A mode of program execution in which the program scans its data from a previously prepared data file

Syntax error

A violation of the C grammar rules


Detected during compilation

Run-time error

An attempt to perform an invalid operation


Detected during program execution

Logic error

An error caused by following an incorrect algorithm

Bussar

Parallella ledningar i ett datorsystem.


T.ex. bussar för data som transporterar information, bussar för adresser som talar om var i minnet saker ska ta vägen samt kontrollbussar som talar om på vilket sätt något ska ske.