Copy the one string into another without using functions
#include<stdio.h>
#include<conio.h>
void main( )
{
char str1[50],str2[50];
int i;
clrscr( );
printf("\nEnter the string :");
gets(str1);
i=0;
while(str1[i]!='\0')
{
str2[i]=str1[i];
i=i+1;
}
str2[i]='\0';
printf("\nResult : %s",str2);
getch( );
}
#include<conio.h>
void main( )
{
char str1[50],str2[50];
int i;
clrscr( );
printf("\nEnter the string :");
gets(str1);
i=0;
while(str1[i]!='\0')
{
str2[i]=str1[i];
i=i+1;
}
str2[i]='\0';
printf("\nResult : %s",str2);
getch( );
}
output :
Enter the string : java
Result : java
Enter the string : java
Result : java
Comments
Post a Comment