Const Qualifier in C. The qualifier const can be applied to the declaration of any variable to specify that its value will not be changed ( Which depends upon where const variables are stored, we may change value of const variable by using pointer ).
The result is implementation-defined if an attempt is made to change a const (See this forum topic). 1) Pointer to variable. We can change the value of ptr and we can also change the value of object ptr pointing to. Pointer and value pointed by pointer both are stored in read-write area. See the following code fragment. Output: *ptr: 10 *ptr: 20 *ptr: 100 2) Pointer to constant. An Easy Firewall Application. Introduction When I published my articles about firewall development, I received some e-mails about how to develop a complete firewall solution using the methods described.
With this tool I want to give these users an easy example of packet filtering utility. In this solution I have used Packet Filtering API for Microsoft Windows 2000 and above. I have developed a MFC class wrapper for this API. With this class, I make a simple MFC application that allows a user to set filter rules in local interfaces. If you want to know more about Packet Filtering API, you can read my article Packet Filtering in .NET. Update history October 6, 2003.- Initial release. FAQ > Reading data from a socket - Cprogramming.com. This item was added on: 2005/02/12 Introduction When people create their first TCP/IP socket based program, they often don't realise what a mine field they're stepping into.
There's a big leap involved in getting from a basic "hello world" style socket program to something that is actually of any real use. In the haste to build something bigger, better and more fun, it is easy to overlook the basic steps needed to allow successful exchange of data through a socket. Here we discuss some of these problems in detail, in hope that the reader can avoid making incorrect assumptions from the start. This particular article covers the princples of controlling the receiving buffer. Sample of incorrect code The following is an extract from a simple socket program that receives data. File Handling in C Language. File Handling in C Language A file represents a sequence of bytes on the disk where a group of related data is stored.
File is created for permanent storage of data. It is a ready made structure. Data structure alignment. For example, when the computer's word size is 4 bytes (a byte means 8 bits on most machines, but could be different on some systems), the data to be read should be at a memory address which is some multiple of 4.
When this is not the case, e.g. the data starts at address 14 instead of 16, then the computer has to read two or more 4 byte chunks and do some calculation before the requested data has been read, or it may generate an alignment fault. Even though the previous data structure end is at address 13, the next data structure should start at address 16. C data types. The C language provides basic arithmetic types, such as integer and real number types, and syntax to build array and compound types.
Several header files in the C standard library contain definitions of support types, that have additional properties, such as providing storage with an exact size, independent of the implementation. Basic types The C language provides the four basic arithmetic type specifiers char, int, float and double, and the modifiers signed, unsigned, short and long. The following table lists the permissible combinations to specify a large set of storage size-specific declarations.
The relation requirements are that the long long is not smaller than long, which is not smaller than int, which is not smaller than short. The minimum size for char is 8 bits, the minimum size for short and int is 16 bits, for long it is 32 bits and long long must contain at least 64 bits. The actual size and behavior of floating-point types also vary by implementation.
Functions. Δυναμική διάθεση μνήμης. C library function isalpha() Description The C library function void isalpha(int c) checks if the passed character is alphabetic.
Declaration Following is the declaration for isalpha() function. Chapter 22: Pointers to Pointers. Since we can have pointers to int, and pointers to char, and pointers to any structures we've defined, and in fact pointers to any type in C, it shouldn't come as too much of a surprise that we can have pointers to other pointers.
If we're used to thinking about simple pointers, and to keeping clear in our minds the distinction between the pointer itself and what it points to, we should be able to think about pointers to pointers, too, although we'll now have to distinguish between the pointer, what it points to, and what the pointer that it points to points to. (And, of course, we might also end up with pointers to pointers to pointers, or pointers to pointers to pointers to pointers, although these rapidly become too esoteric to have any practical use.) The declaration of a pointer-to-pointer looks like int **ipp; where the two asterisks indicate that two levels of pointers are involved. int i = 5, j = 6; k = 7; int *ip1 = &i, *ip2 = &j;
End of File (EOF) in C. Header Files - The C Preprocessor. A header file is a file containing C declarations and macro definitions (see Macros) to be shared between several source files.
You request the use of a header file in your program by including it, with the C preprocessing directive ‘#include’. Header files serve two purposes. Open Source Projects in C. The C Preprocessor. The C Preprocessor The C preprocessor implements the macro language used to transform C, C++, and Objective-C programs before they are compiled.
It can also be useful on its own. --- The Detailed Node Listing --- Overview Header Files Macros Predefined Macros Macro Pitfalls Conditionals Conditional Syntax Implementation Details Obsolete Features Copyright © 1987-2016 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation. This manual contains no Invariant Sections. (a) The FSF's Front-Cover Text is: True and False in C. Now we come to an advanced trick which you do need to know about, but if it only confuses you, come back to this bit later. Most experienced C programmers would wince at the expression if(a!
=0). The reason is that in the C programming language dosen't have a concept of a Boolean variable, i.e. a type class that can be either true or false. Why bother when we can use numerical values.