belongs to collection: C language Pointer Exercises
I have used Code::blocks 12 compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
#include <stdio.h> #define MAX_SIZE 100 // Maximum size of the string int main() { char text1[MAX_SIZE], text2[MAX_SIZE]; char * str1 = text1; char * str2 = text2; // Inputting string from user printf("Enter any string: "); gets(text1); // Coping text1 to text2 character by character while(*(str2++) = *(str1++)); printf("First string = %s\n", text1); printf("Second string = %s\n", text2); return 0; }
Result:
Enter any string: TechStudy-The Complete Debugging Solution
First string = TechStudy-The Complete Debugging Solution
Second string = TechStudy-The Complete Debugging Solution
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used Code::blocks 12 compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
Result:
Enter any string: TechStudy-The Complete Debugging Solution
First string = TechStudy-The Complete Debugging Solution
Second string = TechStudy-The Complete Debugging Solution
need an explanation for this answer? contact us directly to get an explanation for this answer