Types, Operators and Expressions: Variable Names
Types, Operators and Expressions Variables and constants are the basic data objects manipulated in a program. Declarations list the variables to be used, and state what type they have and perhaps what their initial values are. Operators specifyCiteste tot ... 6354 cuvinte
Dimensiune mare - fara imagini |
|
|
Const and volatile
Const and volatile These are new in Standard C, although the idea of const has been borrowed from C++. Let us get one thing straight: the concepts of const and volatile are completely independent. A common misconception is to imagine that somehCiteste tot ... 1833 cuvinte
Dimensiune medie - fara imagini |
|
|
Enums
Enums These fall into the category of ‘half baked’. They aren't proper enumerated types, as in Pascal, and only really serve to help you reduce the number of #define statements in your program. They look like this: enum e_tagvar; Just as wCiteste tot ... 276 cuvinte
Dimensiune mica - fara poza |
|
|
Bitfields
Bitfields While we're on the subject of structures, we might as well look at bitfields. They can only be declared inside a structure or a union, and allow you to specify some very small objects of a given number of bits in length. Their usefulnCiteste tot ... 265 cuvinte
Dimensiune mica - fara poza |
|
|
Simple arrays
Simple arrays The use of arrays in C is often a problem for the beginner. The declaration of arrays isn't too difficult, especially the one-dimensional ones, but a constant source of confusion is the fact that their indices always count from 0.Citeste tot ... 381 cuvinte
Dimensiune mica - fara poza |
|
|
More logical expressions.
More logical expressions. This chapter has already shown how C makes no distinction between ‘logical’ and other values. The relational operators all give a result of 0 or 1 for false and true, respectively. Whenever the control of flowCiteste tot ... 556 cuvinte
Dimensiune mica - fara poza |
|
|
Linkage - Effect of scope
Linkage Although the simple examples have carefully avoided the topic, we now have to look into the effects of scope and linkage, terms used to describe the accessibility of various objects in a C program. Why bother? It's because realistic proCiteste tot ... 1685 cuvinte
Dimensiune medie - fara imagini |
|
|
How the preprocessor works
How the preprocessor works Although the preprocessor (Figure 7.1) is probably going to be implemented as an integral part of an Standard C compiler, it can equally well be though of as a separate program which transforms C source code contaCiteste tot ... 436 cuvinte
Dimensiune mica + cu imagini |
|
|
Pointers and Arrays: Pointers and Addresses
Pointers and Arrays A pointer is a variable that contains the address of a variable. Pointers are much used in C, partly because they are sometimes the only way to express a computation, and partly because they usually lead to more compact andCiteste tot ... 7678 cuvinte
Dimensiune mare + cu imagini |
|
|
Statements: Selection Statements
Statements Except as described, statements are executed in sequence. Statements are executed for their effect, and do not have values. They fall into several groups. statement: labCiteste tot ... 929 cuvinte
Dimensiune mica - fara poza |
|
|
The UNIX System Interface: File Descriptors
The UNIX System Interface The UNIX operating system provides its services through a set of system calls, which are in effect functions within the operating system that may be called by user programs. This chapter describes how to use some of tCiteste tot ... 17171 cuvinte
Dimensiune mare + cu imagini |
|
|
Real types
Real types It's easier to deal with the real types first because there's less to say about them and they don't get as complicated as the integer types. The Standard breaks new ground by laying down some basic guarantees on the precision and ranCiteste tot ... 1152 cuvinte
Dimensiune mica - fara poza |
|
|
Sequence points
Sequence points Associated with, but distinct from, the problems of real-time programming are sequence points. These are the Standard's attempt to define when certain sorts of optimization may and may not be permitted to be in effect. For exampCiteste tot ... 339 cuvinte
Dimensiune mica - fara poza |
|
|
Initialization - Constant expressions
Initialization Now that we have seen all of the data types supported by C, we can look at the subject of initialization. C allows ordinary variables, structures, unions and arrays to be given initial values in their definitions. Old C hadCiteste tot ... 1213 cuvinte
Dimensiune mica - fara poza |
|
|
Control of flow - The if, while, for, switch statement
Control of flow 1. The if statement The if statement has two forms: if(expression) statementif(expression) statement1else statement2 In the first form, if (and only if) the expression is non-zero, the statement is executed. If theCiteste tot ... 2907 cuvinte
Dimensiune medie - fara imagini |
|
|
Structures - Linked lists and other structures
Structures Arrays allow for a named collection of identical objects. This is suitable for a number of tasks, but isn't really very flexible. Most real data objects are complicated things with an inherent structure that does not fit well on to aCiteste tot ... 2840 cuvinte
Dimensiune medie + cu poze |
|
|
Preprocessor statements
Preprocessor statements The first statement in the example is a preprocessor directive. In days gone by, the C compiler used to have two phases: the preprocessor, followed by the real compiler. The preprocessor was a macro processor, whose jobCiteste tot ... 393 cuvinte
Dimensiune mica - fara poza |
|
|
Input and Output: Standard Input and Output
Input and Output Input and output are not part of the C language itself, so we have not emphasized them in our presentation thus far. Nonetheless, programs interact with their environment in much more complicated ways than those we have shown bCiteste tot ... 5682 cuvinte
Dimensiune mare - fara imagini |
|
|
The type of functions - Declaring functions
The type of functions All functions have a type: they return a value of that type whenever they are used. The reason that C doesn't have ‘procedures’, which in most other languages are simply functions without a value, is that in C it is permissCiteste tot ... 3328 cuvinte
Dimensiune medie - fara imagini |
|
|
Expressions involving pointers: Conversions, Arithmetic
Expressions involving pointers Because of the introduction of qualified types and of the notion of incomplete types, together with the use of void *, there are now some complicated rules about how you can mix pointers and what arithmetic with pCiteste tot ... 1068 cuvinte
Dimensiune mica - fara poza |
|
|
Alte pagini