CSC 234 Final

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

scanf(" ", &a, ...)

" ": format string &a: addresses &variable The scanf function allows you to enter values from the keyboard when the program is executed

while( )

"while (condition)" { statements; } The condition is evaluated before the statements within the loop are executed. If the condition is false, the loop statements are skipped, and execution with the statement following the while loop

Format codes (output) %d %e %% %10d

%d: int to decimal %e: float to expontetial format %%: a % sign in the output %10d: int to decimal with minimum field width

logical operators && || !

&& and || or ! not equal to?

.bash_profile

(dot file) at login -login username and password; place to put stuff that applies to your whole session, such as programs you want to start when you login and environmental variable definition -It's a shell script that gets executed every time the shell starts up. It's located in your home directory. Say you want an environment variable set to something every time your shell starts--You can just put that command into the ~/.bash_profile file, and it'll do that automatically.

.bashrc

(dot file) at shell start -place to put stuff that applies only to bash itself, such as alias and function definitions, shell options, and prompt settings -used to open a new terminal window after you have logged in

+ - / *

+ addition - subtraction / division * multiply

long integer data

A long integer can represent a whole integer number whose range is greater than or equal to that of a standard integer on the same machine -64 bits

loop

A set of statements that are repeated

standard input file

-keyboard - "stdin" --> going into the program

standard output file

-terminal screen - "stdout" -->stream where a program writes its output data

EOF from scanf

-way of ending loop EOF INDICATOR: a special character at the end of a file to indicate that the end of the file has been reached EOF CHARACTER: a special character that indicates the end of a text stream -the fscanf function can be used to detect when the end of the data has been reached in a file. Scanf returns the number of values successfully read each time that it is executed. If function returns a different value from what was supposed to read, then the end of the data file has been reached

sentinel value

-way of ending loop -special data values that are used to indicate or signal the last record of a file

comments

/* blahblah */ // blahblah -avoid useless comments, comment more on why rather than what

variable

A memory location that is given a name and whose contents may or may not change during the execution of a program

function

A module that returns at most one value to the invoking statement

source program code

A program in a high- level code -what you write -original C program

object program code

A program in machine language -what gets run -machine language version of original C program

compiler

A program that translates a program in a high level language into machine language

comparison operators < > <= >= ==

< is less than > is greater than <= is less than or equal to >= is greater than or equal to == is equal to

general form of a loop

<<<initialize>>> while(<<continue conditions>>) { <<<computation>>> [includes output] <<<update>>> }

a = array[i+1] + b

= arrayname[subscript] +b

statement

A comment or an instruction in a program

dot files

A configuration file usually stored in users home directory. Dot files are used to configure the settings for many unix programs -name: .name -used to store configurations for different applications but they are sometimes used otherwise as well

directory

A file system cataloging structure in which references to other computer files, and possibly other directories, are kept -a location where files are kept in a list

machine language

A language in which instructions are written as binary strings -low level language -tied closely to the design of the computer hardware -usually written in 2 symbols, 0 and 1 (bits)

file

A location where data is stored -resource for storing info, which is available to a computer program and is usually based on some kind of durable storage -computer files are the "documents" in a library

short integer data

A short integer can represent a whole number which may take less storage, while having a smaller range, compared with a standard integer on the same machine -32 bits +/- 2 billion - -32768 to 32767

assignment

A statement that assigns a value to an identifier

literal/constant

A value that does not change during the execution of a program

redirection of input

Redirection is usually implemented by placing certain characters between commands < to redirect input > to redirect output

character data

Character (char): a data type which represents info that is not restricted to being numeric Character data -a variable that is going to contain a character is defined as an integer or as a character data type

.c file

Code stored in a "C" type file

cd

Command line arguement used to change the current working directory in operating systems -change current directory location

mkdir

Command that creates one or more new directories specified by the directory parameter

gcc

Compile a program written in C (command)

Designing a program

Design the program -given a problem -clarify the problem -think about the DATA -->outline program input->computations/programs->output

alias command

Enables a replacement of a word by another string alias a.out= ./a.out

C

Programming language

floating point data

Floating-point value: a value that can represent both integer and non-integer values Float: 6 digits of precision -max exponent 38 -max value 3.4028323e388 Floating point numbers: how computer stores things--> scientific notation

integer (int) data

Fundamental type used to define numeric variables holding whole numbers ex: int variable --> you created an integer variable

input/ output

Inputs are signals or data received by the system, outputs are signals or data sent from it -communication between computer and outside world (human or another information processing system)

man pages

Manual page is software documentation -include info on computerprograms, format standards, and conventions, and even abstract concepts

file names

Name used to uniquely identify a computer file stored in a file system

Designing a program

Outline program FIll in Outline Test Fix bugs

memory (RAM)

Part of a computer that stores information -RAM= random access memory -type of computer memory that can be accessed randomly; any byte can be accessed w/o touching the preceding bytes

path name

Path to a file is its official name "path name" -the set of directories that have to be traversed to get a file -way of giving an address for the location of a file

flow of control

Refers to the order in which the individual statement, instructions, or functions calls of an imperative or a declarative program are executed or evaluated

ls

Shows what files you have (command)

nano

Text editor for unix-like computing systems (command)

current working directory

The directory or folder that is currently open -will be shown as the prompt or can be seen by using the pwd command

terminal

The hardware used to enter, retrieve, and display electronic data (command) -program that provides a line interface to control the underpinnings of the unix based operating system

string literal (" ")

The representation of a string value within the source code of a computer program -quoted sequence of characters ex: x= "foo" --> "foo" is string literal with value foo

sqrt function

The sqrt( ) function returns the non-negative square root of x

root node

Unix uses a hierarchical structure for organizing files and directories, often referred to as a directory tree - the tree has a single root node, the slash character (/), and all other directories are contained below it

/

Used to access a file in the current directory or move to another one -reserved for trees, can't be in file name

#include

Used to access function definitions defined outside of a source code -almost always used to include header files, which are files that mainly contain function declarations and #define statements -preprocessor directories provide instructions that are performed before the program is compiled

file system

Used to control how data is stored and retrieved -w/o file system, info placed in a storage area would be one large body of data with no way to tell where one piece of info stops and the next begins

mv command

Used to move and rename files or directories ex: mv hate love -->changes to old name of hate to love

When do you need " " around file names?

When a file has spaces you need " " around the whole name

\n \t \r \\ \'

\n= newline \t= horizontal tab \r= carriage return \\= backslash sign \'= single quote

first expression (a) evaluated may avoid second expression being evaluated (b)

a && b (if a is false) a || b (if a is true)

array

a data structure that allows a group of values to be represented with the use of a common name and to be distinguished via subscripts

for loop

a loop that is executed a specified number of times

while loop

a loop that is executed as long as a condition is true

Unix

an "operating system", the most basic program that controls what a computer does and provide easier access to the hardware for the programs you think of as the computer

int arrray[10]

basetype arrayname[size]

cat

concatenate files and print on the standard output

( ) in expressions

construct permits arithmetic expansion and evaluation

a.out file

file format for outputting code -runs the program

for

for (init; condition; increment)

gcc -lm

gcc -lm is needed to compile a program that refers a function from the math library

if statement

if ( << true/false expression >> ) { << computations if true >> } else { << computations if false>> }

else clause of an if

if (condition) { Statement1; Statement2;} else { Statement3; Statement4; } In these type of statements, group of statements are executed when condition is true. If condition is false, then else part statements are executed.

if statements

if (condition) { Statements; } In these type of statements, if condition is true, then respective block of code is executed.

nesting control statements

if (condition1) { Statement1; } else_if (condition2) { Statement2; } else Statement 3; If condition 1 is false, then condition 2 is checked and statements are executed if it is true. If condition 2 also gets failure, then else part is executed.

.

move through directories -current directory

..

move through directories -previous directory, move back -parent directory

\n

new line

!=

not equal to A!=B means A is not equal to B

more

screen-by-screen view of file(s)


Ensembles d'études connexes

HCC Exam 1 (Tissue Integrity and Thermoregulation)

View Set

Series 6: Securities Markets and Analysis (Securities Markets)

View Set

Chapter 6, 6S, Chapter 7 Process Analysis

View Set