suppose there are two strings str1 and str2.
suppose i filled str1 with some characters.Now what i want to do is copying string str2 at some specified location in str1.
How can i do it?
inspire_all
-4
Newbie Poster
Recommended Answers
Jump to PostHow can i do it?
Depends. Do you want to overwrite the characters or do you want to insert the characters and shift everything down..
Jump to PostDo you mean something like this?
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char**argv) { /*make sure str1 is padded with enough room*/ char str1[] = {'H','e','l','l','o',',',' ','W','o','r','l','d','\0',' ',' ', ' ', ' ', ' ', ' '}; char str2[] = "this is more text"; …
All 7 Replies
ling_tj
0
Newbie Poster
inspire_all
-4
Newbie Poster
gerard4143
371
Nearly a Posting Maven
inspire_all
-4
Newbie Poster
gerard4143
371
Nearly a Posting Maven
L7Sqr
227
Practically a Master Poster
naveen1993
-3
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.