Posts

Showing posts from May, 2023

Pointers Notes

Image
 Pointer A pointer is a variable that points to another variable . This means that it holds the memory address of another variable. Put another way, the pointer does not hold a value in the traditional sense; instead, it holds the address of another variable. It points to that other variable by holding its address.  Because a pointer holds an address rather than a value, it has two parts. The pointer itself holds the address. That addresses points to a value. There is the pointer and the value pointed to.  ·        Since ptr is a variable, which contains the address of an integer variable var , it can be declared as: int *ptr; where ptr is called a pointer variable . ·        Declaring pointer variable is quite similar to declaring a normal variable but before insert a star “*‟ operator before it. SYNTAX             data_ type * pointer_name; Where, 1. The a...

Preprocessor Notes

PREPROCESSOR  ⮚      The preprocessor makes programs easier to develop and modify. The preprocessor makes C code more portable between different machine architectures and customize the language. ⮚     The C Preprocessor is not part of the compiler, but is a separate step in the compilation process. ⮚    The C Preprocessor is not part of the compiler, but is a separate step in the compilation process. All preprocessor lines begin with #. ⮚   Preprocessing directives are lines in your program that start with ‘#’. Whitespace is allowed before and after the ‘#’. The ‘#’ is followed by an identifier, the directive name. It specifies the operation to perform. ⮚   The ‘#’ which begins a directive cannot come from a macro expansion. Also, the directive name is not macro expanded. Thus, if foo is defined as a macro expanding to define, that does not make ‘#foo’ a valid pre-processing directive. A pre-processing directive cannot cover mo...