restrict c keyword code example
Example: 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);
}