Rule 1: Assign priority to the pointer declaration by considering precedence and associativity according to the following table.
(): This operator functions as a bracket or function operator.
[]: This operator acts as the array subscription operator.
*: This operator functions as the pointer operator, distinct from its use as a multiplication operator.
Identifier: Although not classified as an operator, it represents the name of the pointer variable. Priority is consistently assigned to the name of the pointer.
Data type: Similarly not categorized as an operator, data types encompass modifiers (e.g., signed int, long double, etc.).
Understanding these concepts is better illustrated through examples:
(1) How to read following pointer?
char (* ptr)[3]
Answer:
Step 1: The operators () and [] share equal precedence. As per the rule of associativity (left to right), the first priority is assigned to ().
Step 2: Within the brackets, * and ptr have equal precedence. According to the right-to-left rule of associativity, the first priority is assigned to ptr, and the second priority goes to *.
Step 3: Assign the third priority to [].
Step 4: As the data type has the least priority, assign the fourth priority to char.
Now, read it in the following manner:
"ptr is a pointer to a one-dimensional array of size three, which contains char-type data."
(2) How to read following pointer?
float (* ptr)(int)
Answer:
Assign the priority by considering precedence and associativity.
Now, read it in the following manner:
'ptr is a pointer to a function whose parameter is of int type and return type is of float type.'
Rule 2: Assign the priority of each function parameter separately, and read each one separately. Understand it through the following example.
(3) How to read following pointer?
void (*ptr)(int (*)[2],int (*) void))
Answer:
Assign the priority considering the rule of precedence and associativity.
Now read it following manner:
ptr is pointer to such function which first parameter is pointer to one dimensional array of size two which contentint type data and second parameter is pointer to such function which parameter is void and return type is int data type and return type is void.
(4) How to read following pointer?
int ( * ( * ptr ) [ 5 ] ) ( )
Answer:
Assign the priority considering the rule of precedence and associativity.
Now read it in the following manner:
"ptr is a pointer to an array of size five, where the contents are pointers to functions with a parameter of void type and a return type of int."
(5) How to read following pointer?
double*(*(*ptr)(int))(double **,char c)
Answer:
Assign the priority considering the rule of precedence and associativity.
Now read it in the following manner:
ptr is a pointer to a function with a parameter of int type and a return type of a pointer to a function. The function it points to has the first parameter as a pointer to a pointer of double data type, the second parameter as a char type data, and the return type as a pointer to double data type.
(6) How to read following pointer?
unsigned **(*(*ptr)[8](char const *, ...)
Answer:
Assign the priority considering the rule of precedence and associativity.
Now read it in the following manner:
"ptr is a pointer to an array of size eight, where the contents of the array are pointers to functions. The functions have the first parameter as a pointer to a constant character, the second parameter as a variable number of arguments, and the return type as a pointer to a pointer of unsigned int data type."
229 comments:
«Oldest ‹Older 201 – 229 of 229Programming 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.....
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 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
It was a great information and Its really worth reading it.
Online Training
software training institute
online classes
Amazing blog with unique information found valuable and enjoyed reading this one. Keep posting. Thanks for sharing.
Data Science Training in Hyderabad
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
Great work sir Thank you
for more at https://www.trickcode.in/
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
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>
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
thanks for sharing nice article visit Best Java Programming Tutorials and Courses
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
I appreciate you giving such lovely content. I learned something from your blog. Continue sharing.
lawyers for bankruptcy near me
Hi.
Thank you for sharing this information with us. This blog was great thanks for giving this information about c language and it uses and we learn some new things in this blog thanks for Sharing this information with us
Here is sharing some Oracle Project Accounting information may be its helpful to you.
Oracle Project Accounting Training
informative blog, your blog help me alot to undrestand this things in easy way, i too have some informative article here reactjs classes in pune
Adding my comment at ones complement + 1
binary number of 2 is:
10
||__ 0 * 2^0 = 0
|___ 1 * 2^1 = 2
0 + 2 = 2
Hence binary number of 2 is 10
Binary number of -2 is
ones complement of 2 + 1
Hence
01)
a = a + b
can be written using:
a = a - ( -b )
a = a - ( ones complement of b + 1 )
a = a - ones complement of b - 1
a = a - ~b - 1
b)
b = a - b
b = a + ( -b )
b = a + (ones complement of b + 1)
b = a + ~b + 1
c)
a = a - b
a = a + ( -b )
a = a + (ones complement of b + 1)
a = a + ~b + 1
It is better to describe above description at interview questions instead of describing and mugging ~b/~a...
Post a Comment