answersLogoWhite

0


Best Answer
  1. /*Program to Copy one string to another using pointer.*/
  2. #include
  3. #include
  4. main()
  5. {
  6. char a[80],b[80],*pa,*pb;
  7. int i=0;
  8. clrscr();
  9. printf("Given first string ");
  10. scanf("%s",a);
  11. pa=&a[0];
  12. pb=&b[0];
  13. while(*pa!='\0')
  14. {
  15. *pb=*pa;
  16. pa++;
  17. pb++;
  18. }
  19. *pb='\0';
  20. printf("\nCopied string is");
  21. puts(b);
  22. }
User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How did copy string one variable to another variable in body of the program in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why all variables are declared with in the function?

It is not necessary to to declare variables inside the function in C. If you declare a variable inside a function, the variable becomes local for the function and another variable of same name can be declared in any other function, but you can not use the variable declared in other function. When you declare any variable outside the function body then the variable becomes global and can be used in any function of the program. Note: errno is an example for a variable declared outside any function.


What is the advantage of static character variable?

Static variables exist for the entire duration of the program. Therefore a static character variable is a character that exists for the entire duration the program is running. Regardless of where a static variable is declared and initialised, it is physically instantiated and initialised when the program loads. If the variable has function scope, whatever value is currently assigned to the variable will remain in effect the next time that function is called, but only the function can modify the variable. If the variable has class scope, then the variable exists even if no instances of the class have yet been instantiated, but any and all instances share the variable (it is common to the class, not to any one instance of the class). Static class variables must be initialised outwith the class body and outwith any other function body, but can only be modified by the class members (both static and non-static) and by friends of the class. If the variable has file scope, then the variable is a global variable. Global variables are largely frowned upon as there's no way to control what code can modify the value. Passing local function variables to other functions is the preferred method as this gives much greater control over which code can access and/or modify the value, as well as limiting the lifetime of the variable. To ensure the variable exists throughout a program's lifetime (as per a static variable), instantiate the variable from within the program's entry point.


What is a javascript variable?

A variable in JavaScript is an identifier that provides a storage location used to store a data value. The data stored at a particular location in memory. That we accessed by using the variable name. In JavaScript programs, a script will have to store the bits of information temporarily. It needs to do its work. It can store this data in variables. In other words, A variable is a symbolic name given to a location in the computer memory. Where we store the value, which can be used in the program. The value of the variable can change during the execution of the program. It may take different values at different times during the execution of the program. The name of the variable that we choose must be meaningful to understand, what it represents in the program. For example var Price = 100; Rules to follow: The name of the variable can contain a letter, digits, underscore(_), and dollar sign($). They must begin with a letter, not with a digit. Uppercase and Lowercase are distinct. That means the variable Total is not the same as total or TOTAl. It should not be a keyword. White space does also not allow. Variable can be any length. Hope this helps. Thank you


Write a PHP program to check whether the number is palindrome or not?

This program only suits PHP. If you want a proper one try C program for it available on web <body> <?php if(isset($_POST['submit'])) { $text = $_POST['text']; $string = mysql_real_escape_string($text); $invert = strrev($string); if($string == $invert) { echo "<br>Given number is a palindrome!!"; } else { echo "<br>Given number is not a palindrome!!"; } } ?> <form method="post"> <input type="text" name="text" id="text" /> <input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" /> </form> </body>


Use the control variable during the execution of the loop?

Control variable which is used in control structures.e.g. for(int i=0;i

Related questions

Why all variables are declared with in the function?

It is not necessary to to declare variables inside the function in C. If you declare a variable inside a function, the variable becomes local for the function and another variable of same name can be declared in any other function, but you can not use the variable declared in other function. When you declare any variable outside the function body then the variable becomes global and can be used in any function of the program. Note: errno is an example for a variable declared outside any function.


What is the advantage of static character variable?

Static variables exist for the entire duration of the program. Therefore a static character variable is a character that exists for the entire duration the program is running. Regardless of where a static variable is declared and initialised, it is physically instantiated and initialised when the program loads. If the variable has function scope, whatever value is currently assigned to the variable will remain in effect the next time that function is called, but only the function can modify the variable. If the variable has class scope, then the variable exists even if no instances of the class have yet been instantiated, but any and all instances share the variable (it is common to the class, not to any one instance of the class). Static class variables must be initialised outwith the class body and outwith any other function body, but can only be modified by the class members (both static and non-static) and by friends of the class. If the variable has file scope, then the variable is a global variable. Global variables are largely frowned upon as there's no way to control what code can modify the value. Passing local function variables to other functions is the preferred method as this gives much greater control over which code can access and/or modify the value, as well as limiting the lifetime of the variable. To ensure the variable exists throughout a program's lifetime (as per a static variable), instantiate the variable from within the program's entry point.


What is a javascript variable?

A variable in JavaScript is an identifier that provides a storage location used to store a data value. The data stored at a particular location in memory. That we accessed by using the variable name. In JavaScript programs, a script will have to store the bits of information temporarily. It needs to do its work. It can store this data in variables. In other words, A variable is a symbolic name given to a location in the computer memory. Where we store the value, which can be used in the program. The value of the variable can change during the execution of the program. It may take different values at different times during the execution of the program. The name of the variable that we choose must be meaningful to understand, what it represents in the program. For example var Price = 100; Rules to follow: The name of the variable can contain a letter, digits, underscore(_), and dollar sign($). They must begin with a letter, not with a digit. Uppercase and Lowercase are distinct. That means the variable Total is not the same as total or TOTAl. It should not be a keyword. White space does also not allow. Variable can be any length. Hope this helps. Thank you


What is a zonule of Zinn?

A zonule of Zinn is another word for a ciliary zonule, a string of strand connecting the ciliary body with the crystalline lens of the eye.


Is a string through body good or bad?

Good. It's just a different tone and sound from a guitar that is does not have a string through body.


Write a PHP program to check whether the number is palindrome or not?

This program only suits PHP. If you want a proper one try C program for it available on web <body> <?php if(isset($_POST['submit'])) { $text = $_POST['text']; $string = mysql_real_escape_string($text); $invert = strrev($string); if($string == $invert) { echo "<br>Given number is a palindrome!!"; } else { echo "<br>Given number is not a palindrome!!"; } } ?> <form method="post"> <input type="text" name="text" id="text" /> <input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" /> </form> </body>


What is variable speed?

A Body has variable speed if it covers unequal distance in equal interval of time is known as Variable Speed


What is variable velocity?

variable velocity can be defined as a moving body whose velocity changes with time


Is Body mass or calorie rate an explanatory variable?

Calories are a variable. Body Mass is the result of multiple variables, like weight, height, and gender.


Does Ashley Tisdale ever wear a string body suit?

yes a black or a white or a red string


Use the control variable during the execution of the loop?

Control variable which is used in control structures.e.g. for(int i=0;i


Independent variable and dependent variable in science?

The independant variable is the variable being manipulated or changed. The dependant variable is the results. For example, seeing how different amounts of steroids affect someones body weight. The independant would be the steroids because you are changing the amount. The dependant is the body weight because those are the results you are getting back.