/* 7.13 enter three integers in ascending order (pointers and functions implement switching )*/
# Include "stdio. H"
# Include "conio. H"
Void swap (int * a, int * B, int * C );
Void main ()
{
Int x, y, z;
Printf ("Enter three integers, Example 1 2 3 \ n ");
Scanf ("% d", & X, & Y, & Z );
Swap (& X, & Y, & Z );
Printf ("sorted: % d, % d, % d \ n", x, y, z );
Getch ();
}
void swap (int * a, int * B, int * C)
{< br> int t;
If (* A> * C)
{T = * A; * A = * C; * c = T ;}< br> If (* A> * B)
{T = * A; * A = * B; * B = T;}
If (* B> * C)
{T = * B; * B = * C; * c = T ;}< BR >}< br>/* 7.15 implement the strcat () function (); */
# include "stdio. H "
# include" conio. H "
char * strcat (char * P1, char * P2);
void main ()
{< br> char S1 [20] = "S1";
char S2 [20] = "S2";
strcat (S1, S2 );
printf ("S1 connected, S1 after S2: % s \ n", S1);
strcat (S1, "string ");
printf ("S1: % s \ n", S1 after S1 and string are connected);
getch ();
}
Char * strcat (char * P1, char * P2)
{
Char * head = p1;
While (* P1! = '\ 0 ')
P1 ++;
While (* P2! = '\ 0 ')
{
* P1 = * P2;
P1 ++;
P2 ++;
}
* P1 = '\ 0 ';
Return head;
}