News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

C Program - Program to interchange string3 with string4

Started by ganeshbala, Jun 10, 2008, 09:13 PM

Previous topic - Next topic

ganeshbala

C Program -Program to interchange string3 with string4

/* Program to interchange string3 with string4 */
main( )
{
char *names[ ] = {
"akshay",
"parag",
"raman",
"srinivas",
"gopal",
"rajesh"
} ;
char *temp ;

printf ( "Original: %s %s", names[2], names[3] ) ;

temp = names[2] ;
names[2] = names[3] ;
names[3] = temp ;

printf ( "\nNew: %s %s", names[2], names[3] ) ;
}

Program to print out the memory locations

/* Program to print out the memory locations */
main( )
{
int num[ ] = { 24, 34, 12, 44, 56, 17 } ;
int i ;

for ( i = 0 ; i <= 5 ; i++ )
{
printf ( "\nelement no. %d ", i ) ;
printf ( "address = %u", &num ) ;
}
}