#include<stdio.h>
int fnCmp(char* str1, char* str2) {
while( (*str1 != '\0' && *str2 != '\0') && (*str1 == *str2)) {
str1++;
str2++;
}
if(*str1 == *str2)
return 0;
else
return *str1 - *str2;
}
int main() {
char str1[] = "abc";
char str2[] = "abc";
int x = fnCmp(str1, str2);
if(x == 0) {
printf("Strings Are Same");
} else {
printf("Strings Are not Same");
}
return 0;
}
Monday, November 29, 2021
Strcmp implementation by self, while mein dhyan de do conditions par check kar raha hai
Subscribe to:
Post Comments (Atom)
Priority queue deleting elements after ascending inputs Gaand Fadd
using namespace std; #include<iostream> #define N 5 class pq { public: int* arr; int front; int rear; pq() { ...
-
using namespace std; #include<stdio.h> #define N 5 class q{ public: int* arr; int front; int rear; q() { ...
-
#include<stdio.h> int fnCmp(char* str1, char* str2) { while( (*str1 != '\0' && *str2 != '\0') && ...
-
#include<stdio.h> void fncpy(char* str2, char* str1) { int i = 0; while(*str1 != '\0') { str2[i] = *str1; ...
No comments:
Post a Comment