Jaga
Jaga
1) DANGLING POINTER:::
1) De-allocation of Memory:
The allocation and deallocation of memory blocks are carried out using library
functions, such as malloc(), calloc(), and free().
2) Function Call:
When the function is finished, all internal variables go through garbage
collection and are no longer in memory, but the main() function’s pointer is still
pointing to that specific address, which is no longer available in memory,
creating a dangling condition.
3) Variable Goes out of the Scope:
A Dangling Pointer in c outside the inner block of code if the address of this
local variable is assigned to a pointer declared outside the scope.
2)MCQ’S
A. if(condition) {
}
B. if(condition) :
C. If { [condition] }
D. None of these
b) #include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
A.3
B.4
C.5
c) When all parts of the for loop are eliminated, what will happen?
e) Which of the following statements correct about k used in the below statement?
char ****k;
3)BITS ROTATION:::
A rotation (or circular shift) is an operation similar to shift except
that the bits that fall off at one end are put back to the other end. In left
rotation, the bits that fall off at left end are put back at right end. In right
rotation, the bits that fall off at right end are put back at left end.
➤BITS MASKING:::
Bit masking is simply the process of storing
data truly as bits, as opposed to storing it as
chars/ints/floats. It is incredibly useful for storing certain
types of data compactly and efficiently. The idea for bit
masking is based on boolean logic.
int number;
scanf("%d",&number);
if(number % 2 ==0)
return 0;
DONE BY—
G.DINESH SWAMY;
CSE-O;
AP22110010960;