know the personalities
hold your mouse,move left and right

DataStructure- Program to swap elements of array of pointers to strings.


job detailsFree Publishing of valuable information(s) in our website-Procedure to submit detailsjob details

Free Publishing of your College/University function details


Free Publishing of Your College/University function details in our website.Please send details to following email ids


technicalsymposium@gmail.com.
technicalsymposium@in.com.
technicalsymposium@yahoo.com.
technicalsymposium@hotmail.com.
Google Groups

Get Free E-Mail Alerts Daily

Get Daily Job/EntranceExam/Scholarships/
Admission/Competitive Exam Details Symposium/Conference Alerts in your email

Please Enter your email id and go to your inbox and confirm.You will be a member in our group.

Email:
Visit this group

Freshers Jobs/Symposium/Conference/Certification &Education News Given Below-Get Now

Freshers Jobs and IT /Govt Jobs

Symposium and Conference Details

Free Lecture Notes

Free Placement Papers

Free Project Codings


                

DataStructure- Program to swap elements of array of pointers to strings.

#include <stdio.h>
#include <conio.h>
#include <string.h>
#define MAX 6
char *names[MAX] ;
int count ;
int add ( char * ) ;
void swap ( int, int ) ;
void show( ) ;
void main( )
{
int flag ;
clrscr( ) ;
flag = add ( "akshay" ) ;
if ( flag == 0 )
printf ( "Unable to add string" ) ;
flag = add ( "parag" ) ;
if ( flag == 0 )
printf ( "Unable to add string" ) ;
flag = add ( "raman" ) ;
if ( flag == 0 )
printf ( "Unable to add string" ) ;
flag = add ( "srinivas" ) ;
if ( flag == 0 )
printf ( "Unable to add string" ) ;
flag = add ( "gopal" ) ;
if ( flag == 0 )
printf ( "Unable to add string" ) ;
flag = add ( "rajesh" ) ;
if ( flag == 0 )
printf ( "Unable to add string" ) ;
printf ( "\nNames before swapping:\n" ) ;
show ( ) ;
swap ( 2, 3 ) ;
printf ( "\nNames after swapping:\n" ) ;
show ( ) ;
getch( ) ;
}
/* adds given string */
int add ( char *s )
{
if ( count < MAX )
{
names[count] = s ;
count++ ;
return 1 ;
}
else
return 0 ;
}
/* swaps the names at given two positions */
void swap ( int i, int j )
{
char *temp ;
temp = names[i] ;
names[i] = names[j] ;
names[j] = temp ;
}
/* displays the elements */
void show ( )
{
int i ;
for ( i = 0 ; i < count ; i++ )
puts ( names[i] ) ;
}

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com