what is restrict keyword in c

Solutions on MaxInterview for what is restrict keyword in c by the best coders in the world

showing results for - "what is restrict keyword in c"
Nicki
12 Jan 2020
1#include <stdio.h>
2
3// The restrict keyword basically says:
4/* 
5	The following pointer can only point to itself.
6    So, if we use the restrict keyword, the mem location
7    of the pointer is only to itself, we cannot point
8    another pointer to the restricted pointer
9*/
10
11// EXAMPLE
12void TakeIn(int* restrict Num1, int num2) {
13  // UNDEFINED BEHAVIOR, Num1 is restrict, only points to itself
14  Num1 = &num2;
15  
16  // num2 will be added by Num1
17  num2 += Num1;
18}
19
20int main(void) {
21  int A = 10;
22  int b;
23  TakeIn(A,b);
24}