#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();
}
//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);
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';
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;
}
You can concatenate two strings using the "+" operator.
Note: Java does not support Pointers.
strcat
i dont no string for servlate
[ string toupper $str ] or [ string tolower $str ]
sdfdg
This is not a question.
print c co com comp compu
program to find maximum of two numbers using pointers
performing string operation using pointers
nahi malum
sorry
i dont no string for servlate
i cant write
pro c language to implement linear search using pointers
[ string toupper $str ] or [ string tolower $str ]
sdfdg
You can use any text-editor, notepad is an example.
mystrcpy (char* dest, char* src) { while ((*dest++ = *src++) != '\0); }
This is not a question.