Wednesday, October 31, 2018

STRING: PROGRAM TO CONCATENATE TWO STRINGS WITHOUT LIBRARY FUNCTIONS

#include<stdio.h>
 #include<conio.h>
void main()
{
char str1[20], str2[10];
int i,c=0,c2=0,j=0;
printf("enter the 1st string:");
gets(str1);
printf("enter the 2nd string:");
gets(str2);
for(i=0;str1[i]!='\0';i++)
{
c++;
}
for(i=0;str2[i]!='\0';i++)
{
c2++;
}
  for(i=c;str2[j]!='\0';i++)
{
str1[i]=str2[j];
j++;
}
str1[i]='\0';
puts(str1);
    getch();

}

No comments:

Post a Comment

Static Member Function

CODE : #include<iostream> using namespace std; class test  {     int code;       static int count;               //static...