Untitled
unknown
plain_text
a year ago
659 B
5
Indexable
#include <stdio.h>
#include <string.h>
int main() {
char str[24] = "Hello World";
char a[24] = {0}, b[24] = {0}, c[24] = {0};
int i, x;
x = strlen(str);
for (i = 0; i < x; i++) {
a[i] = str[i] & 127; // AND operation with 127
b[i] = str[i] ^ 127; // XOR operation with 127
c[i] = str[i] | 127; // OR operation with 127
}
// Null-terminate the strings
a[x] = '\0';
b[x] = '\0';
c[x] = '\0';
printf("The AND operation of string with 127: %s\n", a);
printf("The XOR operation of string with 127: %s\n", b);
printf("The OR operation of string with 127: %s\n", c);
return 0;
}Editor is loading...
Leave a Comment