Thread: Restricted pointers C99.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2011
    Location
    Athens , Greece
    Posts
    357

    Restricted pointers C99.

    Hello to all according to the theory this snippet of code :

    Code:
    #include<stdio.h>
    void f( int * restrict p , int *q);
    
    int main( void )
    {
    	int x=3;
    	
    	f(&x , &x);
    	
    	printf("%d" , x);
    	
    return 0;
    }
    void f ( int * restrict p , int *q ) 
    {
    	(*q) += 1;  // x = 4
    	
    	*q = *p + 2;  // x = 6
    	
    	return;
    }
    procudes Undefined Behaviour or not? I think yes... but I am not sure.

    Thank you in advance for your time.
    Last edited by Mr.Lnx; 07-19-2013 at 07:10 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 43
    Last Post: 05-23-2013, 03:01 PM
  2. Replies: 0
    Last Post: 02-16-2012, 02:00 PM
  3. Restricted Integer
    By kolucoms6 in forum C++ Programming
    Replies: 6
    Last Post: 03-01-2008, 08:59 PM
  4. Forum Restricted
    By XelleX90 in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-26-2006, 08:54 AM
  5. How restricted am I by console mode
    By The Gweech in forum C++ Programming
    Replies: 2
    Last Post: 03-20-2002, 09:25 PM