Skip to content

Category Archives: C Language

Using result of comma operator as l-value is not valid in C. But in C++, result of comma operator can be used as l-value if… Read More
In C/C++, getc() returns EOF when end of file is reached. getc() also returns EOF when it fails. So, only comparing the value returned by… Read More
The order of operands of logical operators &&, || are important in C/C++. In mathematics, logical AND, OR, etc… operations are commutative. The result will… Read More
What do we mean by data alignment, structure packing and padding?Predict the output of following program. c #include <stdio.h>    // Alignment requirements // (typical… Read More
In C, the only operation that can be applied to struct variables is assignment. Any other operation (e.g. equality check) is not allowed on struct… Read More
Size of dynamically allocated memory can be changed by using realloc(). As per the C99 standard: void *realloc(void *ptr, size_t size); realloc deallocates the old… Read More
C supports variable numbers of arguments. But there is no language provided way for finding out total number of arguments passed. User has to handle… Read More
We know that the elements in a structure will be stored in sequential order of their declaration. How to extract the displacement of an element… Read More
What will be the output of the following program? #include<stdio.h> int main() {    int i = 10;    printf("%d", ++(-i));    return 0; } A) 11 B)… Read More
In C/C++, precedence of Prefix ++ (or Prefix –) has same priority than dereference (*) operator, and precedence of Postfix ++ (or Postfix –) is… Read More
What will be the output of the following C program?   C++ #include <iostream> using namespace std;   int main() {      int a = 3,… Read More
In C/C++, when a character array is initialized with a double quoted string and array size is not specified, compiler automatically allocates one extra space… Read More
Predict the output of following C++ program. #include <iostream> using namespace std;    int main() {    int test = 0;    cout << "First  character "… Read More
In C, if an object that has static storage duration is not initialized explicitly, then: — if it has pointer type, it is initialized to… Read More
In C++ switch statement, the expression of each case label must be an integer constant expression. For example, the following program fails in compilation.   CPP /*… Read More

Start Your Coding Journey Now!