..!
, ,
- ??
Ex: char a [] = {a, b, c}, b [] = {a, c, b} , ur , , a!= b
- ?
Ex: char a [] = {a, b, c}, b [] = {a, c, b} , ur , , == b
№ 1:
memcmp . memcomp 0 1 -1,
#include<stdio.h>
#include<string.h>
int main()
{
char a[]={'a','b','c'};
char b[]={'a','b','c'};
int x=memcmp(a,b,sizeof(a));
printf("%d\n",x);
return 0;
}
***output:0***
#include<stdio.h>
#include<string.h>
int main()
{
char a[]={'a','c','b'};
char b[]={'a','b','c'};
int x=memcmp(a,b,sizeof(a));
printf("%d\n",x);
return 0;
}
***output:1***
#include<stdio.h>
#include<string.h>
int main()
{
char a[]={'a','b','c'};
char b[]={''b,'a','c'};
int x=memcmp(a,b,sizeof(a));
printf("%d\n",x);
return 0;
}
***output:-1***
Solution for question number 2:
you can use memcmp for this problem, the best solution for this problem is below
here I answered for the above problem
fooobar.com/questions/1101548 / ...
source
share