GeekInterview.com
Home
Tech Articles
Code Samples
Learn
Freelance Projects
Online Testing
Geek Talk
Job Postings
Knowledge Base
Geek Blogs
Question Bank
Interview Questions
Certification
Placement Papers
Tech FAQ
Career Advice
Engineering
Ask Question
I am new,
Sign me up!
User Name
Remember Me?
Password
Interview Questions
Certification
Placement Papers
Tech FAQ
Career Advice
Engineering
Ask Question
GeekInterview.com
>
Tech FAQs
>
Programming
>
C
Go To First
|
Previous Question
|
Next Question
C
| Question 101 of 110
Print
String Concatination
How to concatenate the two string without using the predefined functions (such as strcat and strlen)?
Total Answers and Comments:
3
Last Update: July 02, 2009 Asked by:
Tarkeshwar_Prasad
Sponsored Links
Best Rated Answer
—
No best answer available. Please pick the good answer available or
submit
your answer.
April 13, 2009 22:37:41
#1
kakiharanadh
Member Since: April 2009 Contribution: 2
RE: String Concatination
char* strcat(char *s char*t)
{
if( t NULL)
return s;
char *temp s;
while( *s ! ' ') // don't compare like *s++! ' ' it lead to errors since wrong pointing.
s++;
while( (*s++ *t++)! ' ');
return temp;
}
Is this answer useful?
Yes
|
No
0
1
Overall Rating:
-1
July 02, 2009 01:47:26
#2
vbablu
Member Since: February 2009 Contribution: 4
RE: String Concatination
void main() { char s1[40] s2[20]; int i 0 j 0;
printf("enter a string");
scanf(" s" s1);
printf("enter another string");
scanf(" s" s2);
while(s1[i]! ' ')
i++;
while(s2[j]! ' ')
s1[i++] s2[j++];
s1[i] ' ';
printf("concatenated string is s" s1);
}
Is this answer useful?
Yes
|
No
July 02, 2009 01:59:18
#3
vbablu
Member Since: February 2009 Contribution: 4
RE: String Concatination
void main() { char s[20]; int i n;
printf( enter a string );
scanf( s s);
for(i 0;s[i]! '';i++)
{
if(s[i] '.')
{
s[i] '';
break;
}}
n atoi(s);
if(n<255)
printf( d is less );
else
printf( not less );
}
Is this answer useful?
Yes
|
No
Go To Top
Sponsored Links
Related Categories
—
ASP.NET FAQ
C FAQs
C# FAQs
C++ Faqs
EJB FAQ
Hibernate FAQs
J2EE FAQ
Java FAQ
Java Classes FAQs
Java Swing FAQs
JSP FAQs
Spring Framework FAQs
Struts FAQ
VB.NET FAQ
Sponsored Links
About Us
-
Privacy Policy
-
Terms and Conditions
-
Contact
-
Ask Question
-
Propose Category
-
Site Updates
Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved