answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

char a[5][10];

int i;

clrscr();

for(i=0;i<5;i++)

{

printf("enter %d string",i+1);

scanf("%s",&a[i]);

}

for(i=0;i<5;i++)

{

printf("\n%s",a[i]);

}

getch();

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

//String Concatenation Without Ready Made String Function
//xstrcat is my own function

#include
void xstrcat(char *,char *);
void main()
{
char s1[30],s2[20];
clrscr();
printf("Enter the String S1:");
gets(s1);
printf("Enter the String S2:");
gets(s2);
xstrcat(s1,s2);
printf("S1=%s",s1);
printf("\nS2=%s",s2);
getch();
}
void xstrcat(char *dest,char *src)
{
while(*dest!='\0')
{
dest++;
}
while(*src!=0)
{
*dest=*src;
src++;
dest++;
}
*dest='\0';
}

output:

Enter the String S1:aaa bbb
Enter the String S2:ccc ddd
S1=aaa bbb ccc ddd
S2=ccc ddd

//String Concatenation With Ready Made String Function

strcat(s1,s2);

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

char *p1 = "Hello";

char *p2 = "World";

char *temp = malloc (sizeof(p1) + sizeof(p2));

i=0;

while(*p1) {

temp[i] = *p1++;i++;

}

while(*p2){

temp[i] = *p2++;i++;

}

temp[i] = '\0';

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

char * MyStrCat (char *FirstString, char * Second String) {

char * ThirdString = malloc ( strlen(FirstString) + strlen(SecondString) + 1);

if ThirdString == NULL ...Handle Memory Exception...

strcpy(ThirdString, FirstString);

strcat(ThirdString, SecondString);

return ThirdString;

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

You can concatenate two strings using the "+" operator.

Note: Java does not support Pointers.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

strcat

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: String concaination program using pointers in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How to perform string operations like concatenation compare etc without using built in functions?

performing string operation using pointers


Write a c program to copy two strings using pointers?

nahi malum


What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


Write a program in java to display a string message using Servlets?

i dont no string for servlate


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


How do you run graphics program in C?

pro c language to implement linear search using pointers


Write a program convert a string from uppercase to lower case and vice-versa without using string tolower and string toupper commands in TCL?

[ string toupper $str ] or [ string tolower $str ]


Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


How do you create a program using string?

You can use any text-editor, notepad is an example.


How do you write a C program to copy to strings using pointers?

mystrcpy (char* dest, char* src) { while ((*dest++ = *src++) != '\0); }


Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.