-
How can I sort a linked list?
Both the merge sort and the radix sort are good sorting algorithms to use for linked lists.
-
-
-
-
How do you print an address?
The safest way is to use printf() (or fprintf() or sprintf()) with the %P specification. That prints a void pointer (void*). Different compilers might print a pointer with different formats. Your compiler will pick a format that’s right for your environment. If you have some other kind of pointer (not a void*) and you want to be very safe, cast the pointer to a void*: printf( “%Pn”, (void*) buffer...
-
-
-
-
What is the easiest sorting method to use?
The answer is the standard library function qsort(). It’s the easiest sort by far for several reasons: It is already written. It is already debugged. It has been optimized as much as possible (usually). Void qsort(void *buf, size_t num, size_t size, int (*comp)(const void *ele1, const void *ele2));
-
What is a function and built-in function?
A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies one or more actions to be performed for a large program.such subprograms are functions. The function supports only static and extern storage classes.By default, function assumes extern storage class.functions have global scope. Only register or auto storage class is allowed in the function...
-
-
What is a null pointer?
There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in <stddef.h>, has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL. The null pointer is used in three ways: 1) To stop indirection in...
-
-
-
-
What is Preprocessor?
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...
-
else
printf("I hate U");
}
">Iii) main(){ float me = 1.1; double you = 1.1; if(me==you)printf("I love U");else printf("I hate U");}
I hate UExplanation:For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.Rule of Thumb: Never compare or at-least be cautious when using floating point numbers with...
-
> (i - (i -1)));
}
}
">Main(){ signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit >> (i - (i -1))); }}
A) 512, 512, 512, 512, 512B) 256, 256, 0, 0, 0C) 512, 256, 0, 0, 0D) 256, 256, 256, 256, 256Explanation: bit's value is not changed
-
What is the purpose of realloc( )?
the function realloc(ptr,n) uses two arguments.the first argument ptr is a pointer to a block of memory for which the size is to be altered.The second argument n specifies the new size.The size may be increased or decreased.If n is greater than the old size and if sufficient space is not available subsequent to the old region, the function realloc( ) may create a new region and all the old data are...
-
C Interview Questions
Ans