...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <string.h>
#include <stdio.h>
int checkpass(const char *password) {
if (strcmp(password, "pass") == 0) {
return 1;
}
}
void func(const char *userinput) {
if (checkpass(userinput)) {
printf("Success\n");
}
} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <string.h>
#include <stdio.h>
int checkpass(const char *password) {
if (strcmp(password, "pass") == 0) {
return 1;
}
return 0;
}
void func(const char *userinput) {
if (checkpass(userinput)) {
printf("Success!\n");
}
} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stddef.h>
size_t getlen(const int *input, size_t maxlen, int delim) {
for (size_t i = 0; i < maxlen; ++i) {
if (input[i] == delim) {
return i;
}
}
}
void func(int userdata) {
size_t i;
int data[] = { 1, 1, 1 };
i = getlen(data, sizeof(data), 0);
data[i] = userdata;
} |
...