hello everyone
i was trying to make my own own string concatenation function but wasnt able to do so. i need ur help.
sahil_logic
0
Light Poster
Recommended Answers
Jump to Posthello everyone
i was trying to make my own own string concatenation function but wasnt able to do so. i need ur help.What don't you understand that prevents you from doing this? What do you think would be a subroutine that does work?
Jump to PostIt should be
str2[j]!='\0'
not
str2[j]=!'/0'
change '/0' in first for loop also...use fgets instead of gets
Jump to PostHere's the corrected code....stop mixing c headers with c++ headers....don't use ancient headers like <iostream.h>...instead use <iostream>.....declare variable outside for loop...not allowed according to latest ISO standard
#include<iostream> #include<conio.h> using namespace std; char m,str1[50],str2[50],str3[100]; int main() { int i,j,temp,l=0; gets(str1); gets(str2); for(i=0;str1[i]!='\0';i++) { str3[i]=str1[i]; l=l+1; } for(j=0;str2[j]!='\0';j++) …
All 11 Replies
Rashakil Fol
978
Super Senior Demiposter
Team Colleague
sahil_logic
0
Light Poster
SpS
34
Posting Pro
sahil_logic
0
Light Poster
SpS
34
Posting Pro
sahil_logic
0
Light Poster
sahil_logic
0
Light Poster
sahil_logic
0
Light Poster
SpS
34
Posting Pro
sahil_logic
0
Light Poster
Dave Sinkula
2,398
long time no c
Team Colleague
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.