Pointers in C

Sort by

recency

|

684 Discussions

|

  • + 0 comments
    void update(int *a,int *b) {
        int sum,diff;
        
        sum = *a + *b;
        
        (*a >*b)?(diff = (*a - *b)):( diff = (*b-*a));
        
        *a = sum;
        *b = diff;
    }
    
  • + 0 comments

    C is such a powerful and foundational language—great for understanding how computers really work. betguru 247 net sign up

  • + 0 comments
    void update(int *a,int *b) {
        *a = (*a + *b);
        (*a > 2*(*b))? (*b = (*a - 2*(*b))): (*b = (2*(*b)-(*a))); 
    
    }
    
  • + 1 comment

    solving with 2s compliment

    void update(int *a,int *b) {
        int sum = *a + *b;  
        int diff = *a - *b;
          
        *a = sum;  
        if((diff) < 0)
            *b = (~diff)+1;
        else
            *b = diff;     
    }
    
  • + 0 comments

    Here is pointers in c problem solution - https://programmingoneonone.com/hackerrank-pointers-in-c-problem-solution.html