C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays structures functions recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c++ tutorials and pdf
That is near pointer cannot access beyond the data segment like graphics video memory, text video memory etc. Size of near pointer is two byte. With help keyword near, we can make any pointer as near pointer.
int near* ptr;
Near pointer only hold 16 bit offset address. Offset address varies from 0000 to FFFF (in hexadecimal).
Note: In printf statement to print the offset address in hexadecimal, %p is used.
Consider following c program:
int near * ptr=( int *)0XFFFF;
Explanation: When we increment or decrement the offset address from maximum and minimum value respectively then it repeats the same value in cyclicorder. This property is known as cyclic nature of offset address.
Cyclic property of offset address.
If you increment the near pointer variable then move clockwise direction. If you decrement the near pointer then move anti clockwise direction.