The pointer which can point or access whole the residence memory of RAM i.e. which can access all 16 segments is known as far pointer.
Size of far pointer is 4 byte or 32 bit. Examples:
(1) What will be output of following c program?
int main(){
int x=10;
int far *ptr;
ptr=&x;
printf("%d",sizeof ptr);
return 0;
}
Output: 4
(2)What will be output of following c program?
int main(){
int far *near*ptr;
printf("%d %d",sizeof(ptr) ,sizeof(*ptr));
return 0;
}
Output: 4 2
Explanation: ptr is far pointer while *ptr is near pointer.
(3)What will be output of following c program?
int main(){
int far *p,far *q;
printf("%d %d",sizeof(p) ,sizeof(q));
}
Output: 4 4
First 16 bit stores: Segment number
Next 16 bit stores: Offset address
Example:
int main(){
int x=100;
int far *ptr;
ptr=&x;
printf("%Fp",ptr);
return 0;
}
Output: 8FD8:FFF4
Here 8FD8 is segment address and FFF4 is offset address in hexadecimal number format.
Note: %Fp is used for print offset and segment address of pointer in printf function in hexadecimal number format.
In the header file dos.h there are three macro functions to get the offset address and segment address from far pointer and vice versa.
1. FP_OFF(): To get offset address from far address.
2. FP_SEG(): To get segment address from far address.
3. MK_FP(): To make far address from segment and offset address.
Examples:
(1)What will be output of following c program?
#include "dos.h"
int main(){
int i=25;
int far*ptr=&i;
printf("%X %X",FP_SEG(ptr),FP_OFF(ptr));
}
Output: Any segment and offset address in hexadecimal number format respectively.
(2)What will be output of following c program?
#include "dos.h"
int main(){
int i=25;
int far*ptr=&i;
unsigned int s,o;
s=FP_SEG(ptr);
o=FP_OFF(ptr);
printf("%Fp",MK_FP(s,o));
return 0;
}
Output: 8FD9:FFF4 (Assume)
Note: We cannot guess what will be offset address; segment address and far address of any far pointer .These address are decided by operating system.
Limitation of far pointer:
We cannot change or modify the segment address of given far address by applying any arithmetic operation on it. That is by using arithmetic operator we cannot jump from one segment to other segment. If you will increment the far address beyond the maximum value of its offset address instead of incrementing segment address it will repeat its offset address in cyclic order.
Example:
(q)What will be output of following c program?
int main(){
int i;
char far *ptr=(char *)0xB800FFFA;
for(i=0;i<=10;i++){
printf("%Fp \n",ptr);
ptr++;
}
return 0;
}
Output:
B800:FFFA
B800:FFFB
B800:FFFC
B800:FFFD
B800:FFFE
B800:FFFF
B800:0000
B800:0001
B800:0002
B800:0003
B800:0004
This property of far pointer is called cyclic nature of far pointer within same segment.
Important points about far pointer:
1. Far pointer compares both offset address and segment address with relational operators.
Examples:
(1)What will be output of following c program?
int main(){
int far *p=(int *)0X70230000;
int far *q=(int *)0XB0210000;
if(p==q)
printf("Both pointers are equal");
else
printf("Both pointers are not equal");
return 0;
}
Output: Both pointers are not equal
(2)What will be output of following c program?
int main(){
int far *p=(int *)0X70230000;
int far *q=(int *)0XB0210000;
int near *x,near*y;
x=(int near *)p;
y=(int near *)q;
if(x==y)
printf("Both pointer are equal");
else
printf("Both pointer are not equal");
return 0;
}
Output: Both pointers are equal
2. Far pointer doesn’t normalize.
286 comments:
«Oldest ‹Older 201 – 286 of 286Very good explanation (even these things are not really "basic".
For Q.17-(4), I think there is a mistake.
int ( * ( * ptr ) [ 5 ] ) ( )
Your Answer:
ptr is a pointer to such array of size five which content are pointers to
such function which parameter is void and return type is int type data.
Should be:
ptr is a pointer to such array of size five which content are pointers to
such function which has undefined (variable) number of parameters and return type
is int type data.
Since : int Foo () is a function which takes an undefined (variable) number of
parameters. That is totally different from int Foo (void) which takes no parameter
and return type is int.
Nice Explanation....Very useful for interviews
int main(){
int num,i=0;
do{
printf("To enter press 1\n");
printf("To exit press 2");
scanf("%d",&num);
++i;
switch(num){
case 1:printf("You are welcome\n");break;
default : exit(0);
}
}
while(i<=10);
return 0;
}
Output: 3 3 4 4
question no 8
how come output is this??
this is wrong
we r not printing any value
Programming in c by Stephen kochain and expert in c
You can also refer numerical recipes inc
Nice site and nice ques
Plz upload some more questions
wow.......this is helpfull blog.....
Nice tutorial. Thanks for sharing the valuable info about c Training. it’s really helpful. Who want to learn c language this blog most helpful. Keep sharing on updated tutorials…..
I can't understand the meaning for third questions answer.Can u please explain me....?
It's great job and more useful to others
Hello there!
I'm Simran from Receptix - a job search portal. I stumbled on your website and I must say it envelopes great information.
Coincidentally, we have a video designed on a topic similar to your blog post on interview questions on C language. I was wondering that incorporating this video can further enhance the user experience on your page. Here's the link to the video
https://www.youtube.com/watch?v=WPnURgypr9U
It will be great if you could also mention www.receptix.com as the source, along with the video.
Look forward to this content synergy.
Thanks
Thank for this blog are more informative step by step and useful contents. I here by attached my site would you see this blog
7 tips to start a career in digital marketing
“Digital marketing is the marketing of product or service using digital technologies, mainly on the Internet, but also including mobile phones, display advertising, and any other digital medium”. This is the definition that you would get when you search for the term “Digital marketing” in google. Let’s give out a simpler explanation by saying, “the form of marketing, using the internet and technologies like phones, computer etc”.
we have offered to the advanced syllabus course digital marketing for available join now
more details click the link now
https://www.webdschool.com/web-development-course-in-chennai.html
Amazing blog useful information
Web designing trends in 2020
When we look into the trends, everything which is ruling today’s world was once a start up and slowly begun getting into. But Now they have literally transformed our lives on a tremendous note. To name a few, Facebook, Whats App, Twitter can be a promising proof for such a transformation and have a true impact on the digital world.
we have offered to the advanced syllabus course web design and development for available join now
more details click the link now
https://www.webdschool.com/web-development-course-in-chennai.html
Great good questions keep it up
Learnprogramo.
Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! 360DigiTMG PMP Certification
PMP Certification in Malaysia
PMP Course
PMP Course in Malaysia
I am impressed by the information that you have on this blog. It shows how well you understand this subject.
data analytics course
big data analytics malaysia
big data course
Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.
data science course
I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more.
360DigiTMG PMP Certification
360DigiTMG PMP Course in malaysia
360DigiTMG PMP Course
360DigiTMG PMP Training in malaysia
360DigiTMG PMP Training
The blog and data is excellent and informative as welldata science course
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
data analytics course
big data analytics malaysia
big data course
It was a great information and Its really worth reading it.
Online Training
software training institute
online classes
Thanks for sharing such a great blog
python training in bangalore | python online Training
artificial intelligence training in bangalore | artificial intelligence online training
machine learning training in bangalore | machine learning online training
uipath-training-in-bangalore | uipath online training
blockchain training in bangalore | blockchain online training
aws training in Bangalore | aws online training
data science training in bangalore | data science online training
hadoop training in bangalore | hadoop online training
iot training in bangalore | iot online training
devops training in banaglore | devops online training
Nice Information Your first-class knowledge of this great job can become a suitable foundation for these people. I did some research on the subject and found that almost everyone will agree with your blog.
Cyber Security Course in Bangalore
Writing in style and getting good compliments on the article is hard enough, to be honest, but you did it so calmly and with such a great feeling and got the job done. This item is owned with style and I give it a nice compliment. Better!
Cyber Security Training in Bangalore
Top quality blog with unique content and found valuable looking forward for next updated thank you
Ethical Hacking Course in Bangalore
Amazing blog with unique information found valuable and enjoyed reading this one. Keep posting. Thanks for sharing.
Data Science Training in Hyderabad
I finally found a great article here. I just added your blog to my bookmarking sites looking forward for next blog thank you.
Data Science Course in Bangalore
I recently found a lot of useful information on your website, especially on this blog page. Among the many comments on your articles. Thanks for sharing.
Business Analytics Course in Bangalore
This is an excellent article. I like this topic. This site has many advantages. I have found a lot of interesting things on this site. It helps me in so many ways. Thanks for posting this again.
Data Analytics Course in Bangalore
Thanks, this is generally helpful.
Still, I followed step-by-step your method in this Python Online Training
Python Online Course
Fantastic blog with excellent information and valuable content just added your blog to my bookmarking sites thank for sharing.
Data Science Course in Chennai
Thanks for sharing. It is very useful article;please visit us at our website :
http://www.univ-msila.dz/en
I really enjoy every part and have bookmarked you to see the new things you post. Well done for this excellent article. Please keep this work of the same quality.
Artificial Intelligence course in Chennai
Mua vé máy bay tại đại lý Aivivu, tham khảo
giá vé máy bay đi Mỹ khứ hồi
vé máy bay từ mỹ về việt nam hãng eva
lịch bay hà nội nha trang
giá vé máy bay sài gòn - phú quốc
vé máy bay đi huế vietnam airlines
This is so helpful, thanks for the detailed explanation. You could find more question on C from here
Thank a lot. You have done excellent job. I enjoyed your blog . Nice efforts
Cyber Security Course in Bangalore
Nice Blog and i would like to thank for the efforts you have made in writing this post, hoping the same best work from you in the future as well. Thanks for sharing. Great websites!
Tableau Training in Bangalore
Such a very useful article and very interesting to read this article, i would like to thank you for the efforts you had made for writing this awesome article. Thank you!
Python Training in Bangalore
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
Data Science Course in Chennai
All of these posts were incredible perfect. It would be great if you’ll post more updates and your website is really cool and this is a great inspiring article.
Artificial Intelligence course in Chennai
Great work sir Thank you
for more at https://www.trickcode.in/
You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.
Data Science Training in Bangalore
I have voiced some of the posts on your website now, and I really like your blogging style. I added it to my list of favorite blogging sites and will be back soon ...
Digital Marketing Training in Bangalore
I found Habit to be a transparent site, a social hub that is a conglomerate of buyers and sellers willing to offer digital advice online at a decent cost.
Artificial Intelligence Training in Bangalore
The Extraordinary blog went amazed by the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.
Machine Learning Course in Bangalore
Awesome article. I enjoyed reading your articles. this can be really a good scan for me. wanting forward to reading new articles. maintain the nice work!
Data Science Courses in Bangalore
I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
Business Analytics Course in Bangalore
Excellent Blog! I would like to thank you for the efforts you have made in writing this post. Gained lots of knowledge.
Data Analytics Course
What an incredible message this is. Truly one of the best posts I have ever seen in my life. Wow, keep it up.
AI Courses in Bangalore
It is late to find this act. At least one should be familiar with the fact that such events exist. I agree with your blog and will come back to inspect it further in the future, so keep your performance going.
Digital Marketing Training in Bangalore
I am more curious to take an interest in some of them. I hope you will provide more information on these topics in your next articles.
Machine Learning Course in Bangalore
I wanted to leave a little comment to support you and wish you the best of luck. We wish you the best of luck in all of your blogging endeavors.
Data Science Training in Bangalore
I am really enjoying reading your well written articles. I am looking forward to reading new articles. Keep up the good work.
Data Science Courses in Bangalore
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
Data Analytics Course
I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
Business Analytics Course in Bangalore
I am happy to visit your blog, a lot of things I can take the benefits of each of your articles. thank you
wordpress
ufa88kh.blogspot
youtube
casino online in cambodia
I was browsing the internet for information and found your blog. I am impressed with the information you have on this blog.
MLOps Course
Extraordinary post I should state and a debt of gratitude is in order for the data. Instruction is unquestionably a clingy subject. Be that as it may, is still among the main subjects within recent memory. I value your post and anticipate more. artificial intelligence course in lucknow
It is late to find this act. At least one should be familiar with the fact that such events exist. I agree with your blog and will come back to inspect it further in the future, so keep your performance going.
Data Scientist Training in Bangalore
Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!data analytics course in nagpur
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.<a href="https://360digitmg.com/india/cloud-computing-course-in-jaipur>cloud computing course in jaipur</a>
Hi, I looked at most of your posts. This article is probably where I got the most useful information for my research. Thanks for posting, we can find out more about this. Do you know of any other websites on this topic?
Ethical Hacking Course in Jaipur
I am looking for and I love to post a comment that "The content of your post is awesome" Great work! Business Analytics Course in Vadodara
This is really nice which is really cool blog and you have really helped a lot of people who visit the blog and give them useful information.
Data Science Training in Noida
The blog and data is excellent and informative as well your work is very good and I appreciate well hopping for some more informative posts.
Business Analytics Course in Gurgaon
I am always searching online for articles that can help me and you made some good points in Features also. Keep working, great job
Data Science Training
The blog is informative and very useful therefore, I would like to thank you for your effort in writing this article.
Data Analytics Course in Lucknow
Interesting post. which i wondered about this issue so thanks for posting and very good article which is a really very nice and useful article. Thank you
Data Science Course in Noida
Very good message. I stumbled across your blog and wanted to say that I really enjoyed reading your articles. Anyway, I will subscribe to your feed and hope you post again soon.
Data Scientist Course in India
If you are looking for Illinois license plate sticker renewals online, you have to go to the right place. We have the fastest Illinois license plate sticker renewals in the state.
Data Science Course in Nagpur
thanks for sharing nice article visit Best Java Programming Tutorials and Courses
Well done for this excellent article. and really enjoyed reading this article today it might be one of the best articles I have read so far and please keep this work of the same quality.
Data Analytics Course in Noida
I think this is a really good article. You make this information interesting and engaging. Thanks for sharing.
Data Science Course in India
Really this article is truly one of the best in article history and am a collector of old "items" and sometimes read new items if i find them interesting which is one that I found quite fascinating and should be part of my collection. Very good work!
Data Scientist Course in Gurgaon
We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work Data Science Training in Vadodara
Informative Post. The information you have posted is very useful and sites you have referred was good. Thanks for sharing.
Data Science Course with Placement
Really, this article is truly one of the best in the article. And this one that I found quite fascinating and should be part of my collection. Very good work!.
Data Science Training in Jaipur
Very great post which I really enjoy reading this and it is not everyday that I have the possibility to see something like this. Thank You.
Best Online Data Science Courses
Just a shine from you here and have never expected anything less from you and have not disappointed me at all which i guess you will continue the quality work. Great post.
Data Science Training in Gurgaon
I am hoping the same best effort from you in the future as well and in fact your creative writing skills has inspired me.
Data Science Course near me
Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.
Data Science in Bangalore
Very useful message. This is my first time visiting here. I found a lot of interesting things on your blog, especially your discussion. It really is a great article. Keep on going.
Data Analytics Course in Ernakulam
Amazing knowledge and I love to share this kind of information with my friends and hope they like it, why I am doing it.
Data Scientist Course in Nagpur
Very nice job... Thanks for sharing this amazing and educative blog post!
Data Science Training in Lucknow
pleasant blog! its fascinating. much obliged to you for sharing Business Analytics Course in Dehradun
Post a Comment