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 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). |
|
|
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 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. |
|
|
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. |
|
|
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. |
|
|
While loop |
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. |
|
|
Do-while loop |
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. |
|
|
Continue statement |
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. |
|
|
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 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;. |
|
|
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. |
|
|
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 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. |
|
|
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 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. |
|