![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 05.02.2020 12:56, leylaanddade
Q6 common mistakes in c
5 points
each of the following code samples below is making a common mistake in c. from the options, select the error type that best categorizes the mistake.
you can assume all the code has the necessary #include macros. also you should assume that the system is 32-bit.
1) #define password "correct horse battery staple"
char *check_permissions (char *user_guess) {
if (user_guess = password) {
return "access granted";
}
return "access denied";
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
2) #define password "correct horse battery staple"
char *check_permissions (char *user_guess) {
if (user_guess == password) {
return "access granted";
}
return "access denied";
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
3) int main () {
char *x = malloc(0x * sizeof(char));
x[0] = '! ';
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
4) int foo () {
int *x = malloc(20);
x[0] = x[1] = 1;
x[2] = x[0] + x[1];
x[3] = 99;
return x[3];
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
5) int main () {
char *x = "patrick";
printf("%s", x);
free(x); // tidy up
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
![answer](/tpl/images/cats/otvet.png)
Answers: 2
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 16:30, rileysndr1782
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 17:00, ayoismeisjjjjuan
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
Do you know the correct answer?
Q6 common mistakes in c
5 points
each of the following code samples below is...
5 points
each of the following code samples below is...
Questions in other subjects:
![Konu](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 17.08.2021 18:00
![Konu](/tpl/images/cats/mat.png)
Mathematics, 17.08.2021 18:00
![Konu](/tpl/images/cats/biologiya.png)
![Konu](/tpl/images/cats/fizika.png)
Physics, 17.08.2021 18:00
![Konu](/tpl/images/cats/istoriya.png)
![Konu](/tpl/images/cats/istoriya.png)
History, 17.08.2021 18:00
![Konu](/tpl/images/cats/istoriya.png)
![Konu](/tpl/images/cats/fizika.png)
Physics, 17.08.2021 18:00
![Konu](/tpl/images/cats/fizika.png)
Physics, 17.08.2021 18:00