• 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/22

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;

22 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)

Variable types

5

Integer types

9

Floating-point types

3

If-else if-else statement

You can have as many else if clauses as you wish. They will each be tested in the order in which they appear until one evaluates as true. The “in the order in which they appear” part is important. Be sure to order your conditions so that you d...

You can have as many else if clauses as you wish. They will each be tested in the order in which they appear until one evaluates as true. The “in the order in which they appear” part is important. Be sure to order your conditions so that you do not get a false positive. For instance, if you swapped the first two tests in the above example, you would never find a floating truck because floating trucks are also light trucks. The final else clause is optional, but it is useful when you want to catch everything that did not meet the earlier conditions.

Conditional operator

Whenever you have a scenario where a value is assigned to a variable based on a conditional, you have a candidate for the conditional operator, which is ?. (You will sometimes see it called the ternary operator because it takes three operands).

Whenever you have a scenario where a value is assigned to a variable based on a conditional, you have a candidate for the conditional operator, which is ?. (You will sometimes see it called the ternary operator because it takes three operands).


Standard libraries

Programmers spend a lot of time studying the standard libraries for the operating systems that they work on. Every company that creates an operating system also has documentation for the standard libraries that come with it. You will learn how to ...

Programmers spend a lot of time studying the standard libraries for the operating systems that they work on. Every company that creates an operating system also has documentation for the standard libraries that come with it. You will learn how to browse the documentation for iOS and OS X in Chapter 16.

Stack

Programmers use the word stack to describe where the frames are stored in memory. When a function is called, its frame is pushed onto the top of the stack. When a function finishes executing, we say that it returns. That is, it pops its frame off the stack and lets the function that called it resume execution.


*The stack is last-in, first-out.

Recursion

The C programming language supports recursion, i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go in infinite loop.

The C programming language supports recursion, i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go in infinite loop.

Static variables

A static variable is like a global variable in that it is declared outside of any function. However, a static variable is only accessible from the code in the file where it was declared.

A static variable is like a global variable in that it is declared outside of any function. However, a static variable is only accessible from the code in the file where it was declared.

Type casting

Type casting is a way to convert a variable from one data type to another data type. For example, if you want to store a long value into a simple integer then you can type cast long to int.

Type casting is a way to convert a variable from one data type to another data type. For example, if you want to store a long value into a simple integer then you can type cast long to int.

While loop

Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.

Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.


For loop

Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable.

Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable.

Do-while loop

Like a while statement, except that it tests the condition at the end of the loop body.

Like a while statement, except that it tests the condition at the end of the loop body.


Break statement

Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch.

Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch.

Continue statement

Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

Getting addresses

The address of a variable is the location in memory where the value for that variable is stored. To get the variable’s address, you use the & operator.

The address of a variable is the location in memory where the value for that variable is stored. To get the variable’s address, you use the & operator.

Storing addresses in pointers

What if you wanted to store an address in a variable? You could stuff it into an unsigned integer that was the right size, but the compiler will help you catch your mistakes if you are more specific when you give that variable its type. For exampl...

What if you wanted to store an address in a variable? You could stuff it into an unsigned integer that was the right size, but the compiler will help you catch your mistakes if you are more specific when you give that variable its type. For example, if you wanted a variable named ptr that holds the address where a float can be found, you would declare it like this: float *ptr;.
We say that ptr is a variable that is a pointer to a float. It does not store the value of a float; it can hold an address where a float may be stored.
Declare a new variable named addressOfI that is a pointer to an int. Assign it the address of i.

Getting the data at an address

If you have an address, you can get the data stored there using the * operator. Have the log display the value of the integer stored at addressofI.

If you have an address, you can get the data stored there using the * operator. Have the log display the value of the integer stored at addressofI.

NULL pointers

The call by reference method of passing arguments to a function copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. This means that changes made to...

The call by reference method of passing arguments to a function copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. This means that changes made to the parameter affect the passed argument.

Structures

C arrays allow you to define type of variables that can hold several data items of the same kind but structure is another user defined data type available in C programming, which allows you to combine data items of different kinds.

C arrays allow you to define type of variables that can hold several data items of the same kind but structure is another user defined data type available in C programming, which allows you to combine data items of different kinds.

Accessing structure members

To access any member of a structure, we use the member access operator (.). The member access operator is coded as a period between the structure variable name and the structure member that we wish to access. You would use struct keyword to def...

To access any member of a structure, we use the member access operator (.). The member access operator is coded as a period between the structure variable name and the structure member that we wish to access. You would use struct keyword to define variables of structure type.

Heap

Sometimes, however, you need to claim a contiguous chunk of memory yourself – a buffer. Programmers often use the word buffer to mean a long line of bytes of memory. The buffer comes from a region of memory known as the heap, which is separate from the stack.
On the heap, the buffer is independent of any function’s frame. Thus, it can be used across many functions. For example, you could claim a buffer of memory intended to hold some text. You could then call a function that would read a text file into the buffer, call a second function that would count all the vowels in the text, and call a third function to spellcheck it. When you were finished using the text, you would return the memory that was in the buffer to the heap.
You request a buffer of memory using the function malloc(). When you are done using the buffer, you call the function free() to release your claim on that memory and return it to the heap.