Chapter:
Strings-in-C-programming-
Write a C program to copy one string to anor string.
Without using pointer:
/**
* C program to copy one string to another string using while loop
*/
#include <stdio.h>
#define MAX_SIZE 100 // Maximum size of the string
int main()
{
char text1[MAX_SIZE];
char text2[MAX_SIZE];
int i;
/* Input string from user */
printf("Enter any string: ");
gets(text1);
/* Copy text1 to text2 character by character */
i=0;
while(text1[i] != '\0')
{
text2[i] = text1[i];
i++;
}
//Makes sure that the string is NULL terminated
text2[i] = '\0';
printf("First string = %s\n", text1);
printf("Second string = %s\n", text2);
printf("Total characters copied = %d\n", i);
return 0;
}Using pointer:
/**
* C program to copy one string to another string using pointer
*/
#include <stdio.h>
#define MAX_SIZE 100 // Maximum size of the string
int main()
{
char text1[MAX_SIZE], text2[MAX....Show MoreAll Chapters
View all Chapter and number of question available From each chapter from C-programming-
C Programs on integers
C Programs with explanation and detailed solution and output for practising and improving your coding skills, suitable for any level learner..
C programs on various integers
C programming tutorials Coming soon...
Learn and master the C Programming concepts with IOEBOOSTER, suitable for both beginners and intermediate level students as per IOE and POU syllabus.These c programming tutorials are completely free and important for exam point of view and for mast..
Recursive program in c
Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem. Such problems can generally be solved by iteration, but this needs to identify and index the smaller instances at programming time.
Arrays
- c programms on arrays
- complete IOE solution on arrays
- Detailed description
- And much more
Strings in C programming
- c programms on Strings
- complete IOE solution on Strings
- Detailed description
- Each one using pointer Concepts
- And much more
Data Files
- C programming concepts of data files and data structures
- IOE C Programming Solutions
- Important Numerous C Program
Pattern Printing in C
Learn to print half pyramid, pyramid, inverted pyramid, Pascal's Triangle Floyd's triangle and various pattern in C Programming using control statements. This helps you to build up your logic towards C Programming Problems.
Similar Question
This Chapter Strings-in-C-programming- consists of the following topics
Guest