This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C program to sort an array with 0,1 and 2 | |
// in a single pass | |
#include<stdio.h> | |
/* Function to swap *a and *b */ | |
void swap(int *a, int *b); | |
// Sort the input array, the array is assumed to | |
// have values in {0, 1, 2} | |
void sort012(int a[], int arr_size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <stdio.h> | |
/* Function to swap values at two pointers */ | |
void swap (char *x, char *y) | |
{ | |
char temp; | |
temp = *x; | |
*x = *y; | |
*y = temp; | |
} |