Write a 'C' Program to reverse a String Using Static Implementation of Stack.


#include

#include

void main()

{

int top=-1,i=0;

char s1[15],s2[15],con[30];

clrscr();

printf("\nEnter 1st String:");

gets(s1);

printf("\nEnter 2nd string:");

gets(s2);

while(s1[i]!=NULL)

{

top++;

con[top]=s1[i];

i++;

}

i=0;

while(s2[i]!=NULL)

{

top++;

con[top]=s2[i];

i++;

}

printf("\nAfter concatenation: \n");

for(i=0;i<=top;i++)

printf("%c",con[i]);

getch();

}


/*OUTPUT


Enter 1st String:Amit


Enter 2nd string:Sharma


After concatenation:

AmitSharma



Enter 1st String:Ganesh                                                        

                                                                               

Enter 2nd string:Verma


After concatenation:

GaneshVerma */
Write a 'C' Program to reverse a String Using Static Implementation of Stack. Write a 'C' Program to reverse a String Using Static Implementation of Stack. Reviewed by on November 16, 2013 Rating: 5
Powered by Blogger.