Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Language%20in%20C%20Interview%20Questions%20and%20Answers

Question: Compare FP_SEG And FP_OFF.
Answer: Sometimes while working with far pointers we need to break a far address into its segment and offset. In such situations we can use FP_SEG and FP_OFF macros. Following program illustrates the use of these two macros.
#include

main( )
{
unsigned s, o ;
char far *ptr = "Hello!" ;

s = FP_SEG ( ptr ) ;
o = FP_OFF ( ptr ) ;
printf ( "n%u %u", s, o ) ;
}

Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook