#include <stdio.h>
#include <ctype.h>
#define MAX 5
int comparacao(char s1[], char s2[], int n) {
int contador = 0;
for (int i = 0; i < n; i++) {
contador++;
} else {
break;
}
}
return contador == n;
}
int main() {
char s1_m[MAX] = {'a', 'b', 'c', 'd', 'e'}, s2_m[MAX] = {'a', 'b', 'c', 'D', 'E'};
int n_m;
printf("quantos caracteres serao verificados(max 5)\n> "); scanf("%d", &n_m
); printf("os %d primeiros caracteres dos dois vetores %ssao iguais", n_m
, comparacao
(s1_m
, s2_m
, n_m
) ? "" : "nao "); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxjdHlwZS5oPgojZGVmaW5lIE1BWCA1CgppbnQgY29tcGFyYWNhbyhjaGFyIHMxW10sIGNoYXIgczJbXSwgaW50IG4pIHsKICAgIGludCBjb250YWRvciA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGlmICh0b2xvd2VyKHMxW2ldKSA9PSB0b2xvd2VyKHMyW2ldKSkgewogICAgICAgICAgICBjb250YWRvcisrOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiBjb250YWRvciA9PSBuOwp9CgppbnQgbWFpbigpIHsKICAgIGNoYXIgczFfbVtNQVhdID0geydhJywgJ2InLCAnYycsICdkJywgJ2UnfSwgczJfbVtNQVhdID0geydhJywgJ2InLCAnYycsICdEJywgJ0UnfTsKICAgIGludCBuX207CiAgICBwcmludGYoInF1YW50b3MgY2FyYWN0ZXJlcyBzZXJhbyB2ZXJpZmljYWRvcyhtYXggNSlcbj4gIik7IHNjYW5mKCIlZCIsICZuX20pOwogICAgcHJpbnRmKCJvcyAlZCBwcmltZWlyb3MgY2FyYWN0ZXJlcyBkb3MgZG9pcyB2ZXRvcmVzICVzc2FvIGlndWFpcyIsIG5fbSwgY29tcGFyYWNhbyhzMV9tLCBzMl9tLCBuX20pID8gIiIgOiAibmFvICIpOwogICAgcmV0dXJuIDA7Cn0=