write a C Program to compare two strings using pointers without strCmp

itstudentjunction



C Program to compare two strings using pointers without strCmp


Compare two strings using pointers program logic:



Accept two strings str1, str2 until end of str1 and str2 check each character in str1 is equal to character in str2. if all characters are equal or same then two strings are equal else strings are unequal. This has to be implemented using pointers.



write a C Program to compare two strings using pointers & FOR LOOP



write a C Program to compare two strings using pointers / write a C Program for comparing two strings without strCmp

#include<STDIO.H>
#include<CONIO.H>
main()
{
char *p,*q;
int i,j,flag=0;
printf("To compare two strings using pointers \n");
printf("\nInput two strings\n");
gets(p);
gets(q);
for(;*p!='\0' || *q!='\0';*p++,*q++)
{
if(*p|=*q)
flag=1;
}
if (flag==1)
printf("\nTwo Strings are different");
else
printf("\nTwo Strings are same");
}

OUTPUT :

To compare two strings using pointers

Input two strings

itstudentjunction

itstudentjunction

Strings are same




write a C Program to compare two strings using pointers & while loop



write a C Program to compare strings without strCmp / write a C Program for comparing two strings using pointers

#include<STDIO.H>
#include<CONIO.H>
main()
{
char *p,*q;
int i,j,flag=0;
printf("To compare two strings without strCmp \n");
printf("\nInput two strings\n");
gets(p);
gets(q);
while(*p!='\0' || *q!='\0')
{
if(*p!=*q)
flag=1;
*p++;
*q++;
}
if (flag==0)
printf("\nTwo Strings are same");
else
printf("\nTwo Strings are different");
}

OUTPUT:

To compare two strings without strCmp

Input two strings

itstudentjunction

hello

Two Strings are different

compare strings programs



compare two strings using arrays

compare two strings using strCmp string function



list of c programs



Most popular programs


write a program to find factorial using c
WAP to Calculate Simple Interest
Check for even / odd
perfect or not
sum of two matrices
display numbers pyramid
show amicable pairs
factors of a number using for loop, while
prime factors of integer using functions recursion
convert to uppercase
generater prime numbers using for loop
print pascal's Triangle using arrays
check reverse string arrays
find string length strlen
Calculate compound Interest
Write a program to find armstrong number or not
print prime numbers using while
solve towers of hanoi
Display Floyd’s Triangle
Write a C program to find reverse string using pointers
prime or not
Show revers number
calculate LCM concatinate strings using arrays
write a program to find palindrome or not
WAP to print sum of Digits
display transpose matrix
show lower triangle
multipiy two matrices
write a program to calculate GCD
strong number or not
find substring or not
string length using arrays
string length using pointers
convert to lowercase
WAP to find factors
count no.of digits
show inverse of matrix
show reverse string strrev
write a program to display upper triangle
concatinate strings strCat
convert to lowercase
palindrome string or not
substring position in a string
compare two strings using arrays
compare strings strcmp
find roots of quadriaic expression
show fibonacci numbers
factorial using recurrsion
sum of factorial series
convert decimal to binary
Write a program to print armstrong numbers

decimal to octal
write a C program to compare two strings using pointers
decimal to hexadecimal
sum of n numbers
average of n
largest of two
largest of n

strong numbers
perfect numbers using for loop


C Programs Data structures Programs in c Data structures Programs in c++ Unix commands Linux commands C++ programs Data structures Algorithms Java Programs UML Diagrams Assembly Language Programs DBMS j2ee programming