C Programming Chapter 4 & 5 Functions and Decision Making

¡Supera tus tareas y exámenes ahora con Quizwiz!

&&

And-allows to combine two different condition test condition to evaluate more than one item at a time

T/F is it good to == a float or double

False var are not always that precise

T/F Global are the best way to use variable

False, Never this is a bad habit and could cause security problems

Important to note about pointers(*)

Forgetting the (*) when using parameter in the definition can cause a segmentation fa

Short Circuit

In a logical operation, evaluation stops once the outcome is known

What is the proper use of ! in an equation

!(a / b) better logic ()

Round

.5 round up below .5 round down

What is false

0

What is true

1

how many paths do if else have

2 if true does this path if false does this path

how many places does function exist in a program

3 places appear in Global declaration section main() and Function definition

What lib is boolean in

<stdbool.h>

Equality Operators

==, !=

Relational Operator

>,<,>=,<=

Absolute value functions

Integer, Float, Double

!

NOT-opposite so 1 is 0 and 0 is 1

Does indentation affect compelling

No

Return Values

Not every functions returns a value but it does not mean it doesn't have one

||

Or test condition to evaluate more than one item at a time

What do function produce

Overhead more processing power is needed

Pass by Reference

Parameters passed is address value Uses the (&) address operator Uses a (*) pointer in front of a parameter void change(int *param); Also use (*) in the definition *param = 8; must mod 2 values

Switch Statements

Sometimes, multiple tests are needed to performed on one variable a nested if else could be used

Every C program is a collection of function T/F

True

T/F Can function accept any data return type

True

T/F Parameters the preferred method in using functions

True

T/F is Each function is a self-contained unit

True

Relational operators are a level of ordnance after or before

above so the will go before

Goto()

allows control to jump to another part of the program

|| can allow

both be true or false

Function Calls

call the function

return;

cause a function to stop at this statement and immediately return to main

Functions

cease everything go do something else than comeback Breaks a big task into smaller more manageable

Casting

changes the data type

Logical Data

conveys either true or false

Conditional Statements

decisions making deals with choosing to excute one set of statements over another

Function Definition

defines the function and returns a value back to main()

round and convert

does the rounding/converting

sqrtf()

does the square root of a var

What does rand() % 10

equality 0 to 9

&& requires what

everything to be true

Put what first in &&

false

rand()

gives a random int number random takes a number and plugs it into that variable use the models operator (%)

Reusability is what?

good practice

What is the most simplest form of Conditional statements

if else

What are functions declared inside the variable

local variables only visible in the block created

What does every C program have to have

main() function

stand()

only once in each random series

Pass by Value

parameters are passed to a function by a value Technically, all parameters in C are pass by value In other words, a copy of the value is made and given to the function The original value in memory is not affected by any changes in the function

Random Numbers

rand() and stand()

Truncate

removes an decimal numbers converts to the same type to the same type

Function Declaration

return type name( vars ); any data return type even void

Floor Functions

reverse the ceiling functions

Ceiling Functions

round a float # up to the next whole number can't use an Integer

Powf()

takes two parameters power of 3

What is the best randomization

time

Structure/Hierarchy charts

top down design method in programming and system development

Put what first in ||

true

Math Functions

use <math.h> and compile with -lm gives some functions not the the <stdio.h> and <stdlib.h>

Function Documentation

very function should have block comments before the function give the some info on the reason for it

Parameters

what data is being sent to the function

Scope

what is seen what does the function have access to


Conjuntos de estudio relacionados

Pharmacology - Chapter 25: Muscle Relaxants

View Set

Comparative Vertebrate Anatomy Exam 2

View Set

Chapter 05: The Working Cell Dynamic Study Module

View Set

CCNA 1 (v5.1 + v6.0) Chapter 3 Exam Answers 2018

View Set

CPSC 317 Internet Computing: Module 4 (Socket programming with TCP)

View Set

ACE Personal Trainer Manual: Chapter 5

View Set

Econ 401 Exam 4- Marc Herold UNH 2019

View Set

Big Ideas Math Blue Book Chapter 5 - Systems of Linear Equations

View Set