Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void sort(int *);
- void monitor(int *);
- int main(void)
- {
- int nNumb[7] = { 9, 3, 8, 4, 5, 1, 12};
- monitor(nNumb);
- sort(nNumb);
- monitor(nNumb);
- }
- void sort (int *p)
- {
- int i, n1;
- int flag = 0;
- L_01: for( i = 0; i < 7; i++)
- {
- if( p[i] > p[i+1])
- {
- flag += 1;
- n1 = p[i];
- p[i] = p[i+1];
- p[i+1] = n1;
- }
- }
- if( flag > 1)
- {
- goto L_01;
- }
- }
- void monitor( int *p1)
- {
- int i;
- for( i = 0; i < 7; i++)
- {
- printf("%d \t", p1[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement