String copy without using string handling function
In this example, we will understand to perform Palindrome String without using string handling function and know how to write, compile and debug it in C language and also learn how to implement it in c.
As you know the best way to do this program is by using the strcpy() function but in this example we copy string manually without using any string handling function
In order to do this you will need
- Basic knowledge of c programming language.
- As well as know how to operate codeblocks.
So let's begin with our program
1.Open a codeblocks software.
2.Open new empty file.
3.Copy and paste the code from below.
Input code-
//program to perform string operations like string copy without using string handling function
#include <stdio.h>
int main()
{
int s1[100],s2[100],i;
printf("Enter string sl: ");
scanf ("%s",s1);
for(i = 0; s1[i]!='\0'; i++)
{
s2[i]=s1[i] ;
}
s2 [i] ='\0';
printf("String s2: %s", s2);
return 0;
}
Now simply build the code. Look for any error. Now run the code.
For output enter any number or character series you want and press enter key.
Click the following button to download a program to perform string operations like string copy without using string handling function
Tags:
string handling function