1. calloc(…) allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size).
malloc(…) takes in only a single argument which is the memory required in bytes. malloc(…) allocated bytes of memory and not blocks of memory like calloc(…).
2. malloc(…) allocates memory blocks and returns a void pointer to the allocated space, or NULL if there is insufficient memory available.
calloc(…) allocates an array in memory with elements initialized to 0 and returns a pointer to the allocated space. calloc(…) calls malloc(…) in order to use the C++ _set_new_mode function to set the new handler mode.
The preprocessor is used to modify your program according to the preprocessor directives in your source code.
Preprocessor directives (such as #define) give the preprocessor specific instructions on how to modify your source code. The preprocessor reads in all of your include files and the source code you are compiling and creates a preprocessed version of your source code.
This preprocessed version has all of its macros and constant symbols replaced by their corresponding code and value assignments. If your source code contains any conditional preprocessor directives (such as #if), the preprocessor evaluates the condition and modifies your source code accordingly.
The preprocessor contains many features that are powerful to use, such as creating macros, performing conditional compilation, inserting predefined environment variables into your code, and turning compiler features on and off.
For the professional programmer, in-depth knowledge of the features of the preprocessor can be one of the keys to creating fast, efficient programs.
The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications.
Hashing is a process for message digest. Hash value is the collection of text.
Producing hash values for accessing data or for security. A hash value (or simply hash), also called a message digest, is a number generated from a string of text. The hash is substantially smaller than the text itself, and is generated by a formula in such a way that it is extremely unlikely that some
Hashing is also a common method of accessing data records. Consider, for example, a list of names:
To create an index, called a hash table, for these records, you would apply a formula to each name to produce a unique numeric value. So you might get something like:
1345873 John smith
3097905 Sarah Jones
4060964 Roger Adams
Then to search for the record containing Sarah Jones, you just need to reapply the formula, which directly yields the index key to the record. This is much more efficient than searching through all the records till the matching record is found.
Basically it has three core feature.
1. It retains the value between function calls.
2.By default function is extern..so it will be visible from other files if the function declaration is as static..it is invisible for the outer files
3. By default we can use the global variables from outside files If it is static global..that variable is limited to with in the file.
int variable = 10;
int i = 0;
style="color: #7f0055;"> #000000;">useStatic
printf("after 1st call \n");
2nd call \n");
IIIrd call \n");
static int j = 0;
int k = 10;
printf("value of j %d k %d",j,k);
value of j 0 k 10 After 1st call
value of j 10 k 10 After IInd call
value of j 20 k 10 After IIUrd call