#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() { ...
-
//See sabse pehle ek khali node bana lena jiska prev and next null ho uske bad use return kar le fir saare operation perform kar lena //Tim...
-
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void add(struct node** tail, int val...
-
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void inElFr(struct node** head, int ...
No comments:
Post a Comment