answersLogoWhite

0

#include<stdio.h>

#include<string.h>

#include<conio.h>

void main()

{

char str1[10],str2[10];

printf("Enter string.\n");

gets(str2);

strcpy(str2,str1);

printf("Copied string is %s",str1);

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

How do you get odd ascii letters from a given string using string copy?

there is no such method using string copy


Write a program to concate the string without using strconcat function?

If you don't need to preserve the first string you could just iterate over the second string and copy each character onto the end of the first string, then return that


Write a program to copy the value of one string variable to another variable?

You can have two String variables (note that String variables are object references) refer to the same String object like so: String str1 = "Hello"; String str2 = str1; Now the str1 and str2 are references for the same String object containing the word "Hello". If you actually want a new String object with a copy of the contents of the original String, you use the String constructor that takes a String argument, like so: String str3 = new String(str1); Now str1 and str3 refer to SEPARATE String objects that happen to contain the same sequence of characters (the word "Hello"). Since Strings objects in Java are immutable, they can be shared without worrying about the contents used by one variable being upset by the use through another variable as might happen with char[] arrays in C or C++ so the first method is probably sufficient for most cases.


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


How do you copy a string from one method into another string in another method in java?

You can have two String variables (note that String variables are object references) refer to the same String object like so: String str1 = "Hello"; String str2 = str1; Now the str1 and str2 are references for the same String object containing the word "Hello". If you actually want a new String object with a copy of the contents of the original String, you use the String constructor that takes a String argument, like so: String str3 = new String(str1); Now str1 and str3 refer to SEPARATE String objects that happen to contain the same sequence of characters (the word "Hello"). Since Strings objects in Java are immutable, they can be shared without worrying about the contents used by one variable being upset by the use through another variable as might happen with char[] arrays in C or C++ so the first method is probably sufficient for most cases.

Related Questions

How do you get odd ascii letters from a given string using string copy?

there is no such method using string copy


Is fill handle used to copy contents in Excel?

A fill handle can copy anything and in different ways. It can copy contents and it can copy formulas and it can create fill series.


Why does the copy button copies the contents and format of the source area to the office clip board?

Copy will copy the format and content of the source area and place it in what is known as the Clipboard, which is a reserved area in the computer's memory.


How do you copy the contents of a movie DVD?

You can use E.M. Free DVD Copy to copy the contents of the movie DVD, following the steps shown in the Related Links.


How do you copy the contents of a youtube playlist into another?

A new web tool called Copy YouTube Playlists will show you how to copy the contents of a YouTube playlist into another.


Write a program to concate the string without using strconcat function?

If you don't need to preserve the first string you could just iterate over the second string and copy each character onto the end of the first string, then return that


C program to copy two strings in to a new string with out using stringcopy in borland c?

You can use so called concatenation of strings:{...string str1 = "something here";string str2 = " and something here";string newStr = str1 + str2;...}


What is a copy cell in Excel?

When you copy a cell, you copy the contents of the cell. Excel allows you to paste those contents in a variety of ways. For example, you can paste either the cell contents (like a formula =A1+B3) or the cell value (like 143).


How do you copy contents of pdf to word?

The contents of a PDF file can simply be copied and pasted into a blank word template. Be sure to highlight the PDF documents entire contents, copy, then paste into word,


Write a program to copy the value of one string variable to another variable?

You can have two String variables (note that String variables are object references) refer to the same String object like so: String str1 = "Hello"; String str2 = str1; Now the str1 and str2 are references for the same String object containing the word "Hello". If you actually want a new String object with a copy of the contents of the original String, you use the String constructor that takes a String argument, like so: String str3 = new String(str1); Now str1 and str3 refer to SEPARATE String objects that happen to contain the same sequence of characters (the word "Hello"). Since Strings objects in Java are immutable, they can be shared without worrying about the contents used by one variable being upset by the use through another variable as might happen with char[] arrays in C or C++ so the first method is probably sufficient for most cases.


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


How do you copy one string to another without using function in c plus plus?

If you're using the std::string, why don't you just create another string instance like this: std::string hello = "hello"; std::string hello1; hello1 = hello; This will have copied the contents of the variable hello into hello1; char *psz1 = "This is a test."; char *psz2 = "..............."; // note - must be same or greater number of characters as psz1 char *p1 = psz1; char *p2 = psz2; while ((*p2++ = *p1++) != '\0'); // copy p1 to p2 Note: This is a trivial example, and might not work on most modern compilers that treat string literals as const or that place them into read-only memory. To solve this you need to replace the second line with ... char *psz2 = new char[16]; ... and then test to make sure that psz1 != NULL.