20130509

How to compare two strings using pointer without strcmp


/*C++/CPP/C program to compare two strings without using  library function strcmp*/
#include<stdio.h>
#include<string.h>
int strCmp(char *p1, char *p2);

int main()
{
char arr1[20];
printf("Enter a String:\n");
scanf("%s",&arr1);
char arr2[20];
printf("Enter a String:\n");
scanf("%s",&arr2);

printf("You entered:%s and %s\n",arr1,arr2);

20130505

How to copy a string without using strcp with pointer

/*How to copy a string without using library function strcpy.
How to use pointer/array to copy a string/sentence. C++/CPP/C program/code to copy a string/word/sentence without using inbuilt function strcpy.How copy a string without using library function strlen. cpp program to copy a string using pointer.cpp program to copy a string without using library function strcpy*/
#include<stdio.h>
#include<string.h>

void strCpy(char *p2,char *p1);

int main()
{
char arr1[20];
char arr2[20];
printf("Enter a String:\n");
scanf("%s",&arr1);

strCpy(arr2, arr1);

printf("You entered and copied:%s\n",arr2);

20130504

How to find the length of a string without using library function strlen


/*How to find length of a string without using library function strstr.
How to use pointer/array to find length of string sentence. C++/CPP/C program/code to find length a string/word/sentence without using inbuilt function strlen.How to find the length of a string without using library function strlen*/
#include<stdio.h>
#include<string.h>

int strLen(char *p);

int main()
{
char arr1[20];
printf("Enter a String:\n");
scanf("%s",&arr1);

printf("You entered:%s\n",arr1);
int n;
n=strLen(arr1);
printf("Strlen of entered string is:%d\n",n);

20130503

How to reverse a string using pointer or array in cpp without using strrev library function

How to reverse a string using pointer or array. CPP program for reversing a strings without using inbuilt library function strrev. How to reverse a sentence in cpp/C++/C without using library function strrev.Program to reverse a string using pointer.
#include<stdio.h>
#include<string.h>
int main()
{
char arr1[20];
printf("Enter a String:\n");
scanf("%s",&arr1);
printf("You entered:%s\n",arr1);

20130428

CPP program for concatenating two strings without using inbuilt library function strcat


How to concatenate two strings using pointer or array. CPP program for concatenating two strings without using inbuilt library function strcat. How to concatenate two strings in cpp/C++/C without using inbuilt in function strcat.Program to concatenate two strings using pointer.

#include<stdio.h>
#include<string.h>
int main()
{
char arr1[20];
printf("Enter a String:\n");
scanf("%s",&arr1);