Showing posts with label strcmp. Show all posts
Showing posts with label strcmp. Show all posts

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);