top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is restricted pointers in C?

+3 votes
456 views

I recently came to know about Restricted pointers in C. Can anyone throw some light on how and when is it used?

posted Mar 27, 2014 by Merry

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

restrict is a keyword that can be used in pointer declarations. The restrict keyword is a declaration of intent given by the programmer to the compiler. It says that for the lifetime of the pointer, only it or a value directly derived from it will be used to access the object to which it points.

answer Mar 28, 2014 by Harshita Dhaliwal
Please share any example to help in better understanding.
Let me describe in simple words - The restrict type qualifier is an indication to the compiler that, if the memory addressed by the restrict-qualified pointer is modified, no other pointer will access that same memory.

A nice article just check this
http://docs.cray.com/books/004-2192-002/html-004-2192-002/rvusi2c1glen.html
Similar Questions
+4 votes

Is it valid in C

P = P1 + P2 - P3 
+2 votes

I know about the forward declaration of structure but don't know when it should be used or preferrable ? I can't envision the scenario.

...