Answers for "what is restrict keyword in c"

C
0

what is restrict keyword in c

#include <stdio.h>

// The restrict keyword basically says:
/* 
	The following pointer can only point to itself.
    So, if we use the restrict keyword, the mem location
    of the pointer is only to itself, we cannot point
    another pointer to the restricted pointer
*/

// EXAMPLE
void TakeIn(int* restrict Num1, int num2) {
  // UNDEFINED BEHAVIOR, Num1 is restrict, only points to itself
  Num1 = &num2;
  
  // num2 will be added by Num1
  num2 += Num1;
}

int main(void) {
  int A = 10;
  int b;
  TakeIn(A,b);
}
Posted by: Guest on April-16-2020

Code answers related to "C"

Browse Popular Code Answers by Language