C Programming Reference


C Programming Reference >> C Basic Tutorials >> C Keywords Home >>

restrictui

30/12/06 -  Views - Ratings :   3.48 of 5 / 155 Votes    

This a very innovative new feature added by C99. Restrict keyword are applicable only to pointers. Restrict qualifiers tells the compiler that pointer is the only mean by which the object can be accessed. Another pointer can access it only if its based on the first one. This enables complier to produce highly efficient code by assuming that if two pointers are declared as restrict then these two pointers doesnot overlap.

Code -
void function (restrict int *a, restrict int *b) \\ a and b pointers cannot overlap ie. point to same memmpry location.
{
int temp = *a;
*a = *b;
b = temp;

}

Back To Top


      

 

 

© 2006 cencyclopedia.com