user_id stringlengths 24 24 | time stringlengths 24 24 | feature_type stringclasses 5
values | feature_version stringclasses 2
values | input_question stringlengths 1 1.24k ⌀ | input_code stringlengths 2 18.5k ⌀ | input_intention stringlengths 1 2.48k ⌀ | input_task_description stringlengths 18 3.32k ⌀ |
|---|---|---|---|---|---|---|---|
63c649005f004bf4898d01b6 | 2023-03-29T05:54:51.475Z | General Question | v2 | explain the main idea of lab 11
| null | null | null |
63c649005f004bf4898d01b6 | 2023-03-29T05:55:16.989Z | General Question | v2 | what does the read_from function do in lab 11 | null | null | null |
63c649005f004bf4898d01b6 | 2023-03-29T05:55:58.479Z | General Question | v2 | what are sockets | null | null | null |
63c649005f004bf4898d01b6 | 2023-03-29T05:56:44.559Z | General Question | v2 | what are file descriptors | null | null | null |
63c649005f004bf4898d01b6 | 2023-04-05T02:31:15.590Z | Help Fix Code | v2 | Loop through user linked list twice. Put all names of users in a buffer string called buf. | char *list_users(const User *head)
{
// First loop: add up all string lengths
int str_len_sum = 0;
int name_count = 0;
const User *curr = head;
while (curr != NULL)
{
str_len_sum += strlen(curr->name);
name_count++;
curr = curr->next;
}
// malloc buf: name_count... | null | null |
63c649005f004bf4898d01b6 | 2023-04-06T04:22:32.473Z | Help Fix Code | v2 | This is a server that asks for the client's username. | struct sockaddr_in *self = init_server_addr(PORT);
int listenfd = set_up_server_socket(self, 5);
while (1)
{
int fd = accept_connection(listenfd);
if (fd < 0)
{
continue;
}
// Receive messages
char buf[INPUT_BUFFER_SIZE] = {'\0'};
int inbuf = 0; // How many bytes currently in buffer?
int room ... | null | null |
63c649005f004bf4898d01b6 | 2023-04-06T05:00:40.060Z | General Question | v2 | how to i test a server using netcat | null | null | null |
63c649005f004bf4898d01b6 | 2023-04-22T08:32:18.487Z | Explain Code | v2 | null | for
i in* do if[-d $i];
then export PATH = $PATH : $(pwd) / $i fi done | null | null |
63c649005f004bf4898d01b6 | 2023-04-22T08:33:35.144Z | General Question | v2 | what is a PATH variable | null | null | null |
63c649005f004bf4898d01b6 | 2023-04-22T08:40:19.113Z | Explain Code | v2 | null | int y = x | 1 | null | null |
63c649005f004bf4898d01b6 | 2023-04-22T22:18:16.492Z | General Question | v2 | is char **p a pointer to a string?
| null | null | null |
63c649005f004bf4898d01b6 | 2023-04-23T03:31:25.752Z | Help Fix Code | v2 | allocate memory for a string | char **s = malloc(sizeof(char *)) | null | null |
63c649005f004bf4898d01b6 | 2023-04-23T04:06:44.670Z | Explain Code | v2 | null | char n = 25; | null | null |
63c649015f004bf4898d01bb | 2023-01-28T23:02:38.070Z | General Question | v1 | how to scan until end of line using scanf | null | null | null |
63c649015f004bf4898d01bb | 2023-01-28T23:06:18.073Z | Question from Code | v1 | is this valid? | scanf("%*s %*d"); | null | null |
63c649015f004bf4898d01bb | 2023-01-28T23:07:11.639Z | General Question | v1 | why did I get "abort" message when compiling my code | null | null | null |
63c649015f004bf4898d01bb | 2023-01-28T23:09:20.853Z | Question from Code | v1 | what is the bug in my code when I compile it with standard input "total 329
-rwx------ 1 reid staff 1734 Jun 22 14:52 prog
-rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt
-rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz
-rw-r--r-- 1 reid staff 88 Feb 15 2013 xyz.c"? | #include <stdio.h>
#include <stdlib.h>
// TODO: Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char* min_permissions, char* file_permissions) {
// parameters: user-specified permissions, actual file permissions --> compare them and return 1 or 0
// check fo... | null | null |
63c649015f004bf4898d01bb | 2023-01-28T23:12:12.330Z | Question from Code | v1 | Why do I get "abort" error message when I run this program with command line argument "1" and standard input "total 329
-rwx------ 1 reid staff 1734 Jun 22 14:52 prog
-rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt
-rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz
-rw-r--r-- 1 reid staff 88 Feb 15 20... | #include <stdio.h>
#include <stdlib.h>
// TODO: Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char* min_permissions, char* file_permissions) {
// parameters: user-specified permissions, actual file permissions --> compare them and return 1 or 0
// check fo... | null | null |
63c649015f004bf4898d01bb | 2023-01-28T23:22:12.392Z | General Question | v1 | what does this error mean: "zsh: abort ./count_large 1 < handout.test" when I execute my program in the command line? | null | null | null |
63c649015f004bf4898d01bb | 2023-02-12T20:18:16.485Z | Question from Code | v1 | why am I getting a segmentation fault when i run this? | void list_users(const User *curr) {
if (curr != NULL) {
User *c = (User *) curr;
while (c != NULL) {
printf("%s", c->name);
curr = curr->next;
}
}
} | null | null |
63c649015f004bf4898d01bb | 2023-02-12T20:21:03.665Z | General Question | v1 | Why can't I cast a const pointer to a pointer and then dereference it? | null | null | null |
63c649015f004bf4898d01bb | 2023-02-12T21:30:21.464Z | Question from Code | v1 | What are the bugs in my code that causes errors? | int make_friends(const char *name1, const char *name2, User *head) {
// find both users
User *user1 = find_user(name1, head);
User *user2 = find_user(name2, head);
// at least one of the users does not exist, return 4
if (user1 == NULL || user2 == NULL) {
return 4;
}
// same user p... | null | null |
63c649015f004bf4898d01bb | 2023-03-10T20:28:24.027Z | General Question | v2 | How can I create a new process to run a different executable that takes from stdin? | null | null | null |
63c649015f004bf4898d01bb | 2023-03-10T20:44:33.427Z | General Question | v2 | How can I create a new process to run a different executable with input from stdin? | null | null | null |
63c649015f004bf4898d01bb | 2023-03-10T21:06:22.535Z | General Question | v2 | How do I use dup2 in C to duplicate the file descriptor of the read end of a pipe to stdin? | null | null | null |
63c649015f004bf4898d01bb | 2023-03-16T00:06:26.475Z | Question from Code | v2 | what is wrong with my code? what does it do? | #include <stdio.h>
#include <stdlib.h>
int main() {
char **args = malloc(sizeof(char **) * 5);
char *c1 = malloc(sizeof(char) * 4);
c1[0] = 'a';
c1[1] = 'b';
c1[2] = 'c';
c1[3] = 'd';
args[0] = c1;
return 0;
}
| null | null |
63c649025f004bf4898d01c5 | 2023-01-24T17:04:14.822Z | Question from Code | v1 | what does this one do? | int check_permissions(char *file, char *required){
int result = 1;
int i;
for (i = 0; i < 9 ; i++){
if (file[i] != required[i] && required[i] != '-'){
result = 0;
}
}
return result;
}
| null | null |
63c649025f004bf4898d01c5 | 2023-01-24T17:07:03.108Z | Help Fix Code | v1 | null | int check_permissions(char *file, char *required){
int result = 1;
int i;
for (i = 0; i < 9 ; i++){
if (file[i] != required[i] && required[i] != '-'){
result = 0;
}
}
return result;
}
| check whether two string match with some tolerance
| null |
63c649025f004bf4898d01c5 | 2023-01-24T17:33:00.168Z | General Question | v1 | how to use scanf() to read a whole line | null | null | null |
63c649025f004bf4898d01c5 | 2023-01-24T19:52:38.599Z | Question from Code | v1 | how to solve segmentation fault | #include <stdio.h>
#include <stdlib.h>
// TODO: Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char *file, char *required){
int result = 1;
int i;
for (i = 0; i < 9 ; i++){
if (file[i] != required[i] && required[i] != '-'){
result = 0;
... | null | null |
63c649025f004bf4898d01c5 | 2023-01-25T16:10:04.518Z | Explain Code | v1 | null | void fib(int **fib_sequence ,int count){
*fib_sequence = malloc(sizeof(int) * count);
if (count == 1){
*fib_sequence[0] = 0;
} else {
*fib_sequence[0] = 0;
*fib_sequence[1] = 1;
int i;
for (i = 2; i < count; i++){
*fib_sequence[i] = *fib_sequence[i - 1] + *fib_sequence[i -2];
}
}
} | null | null |
63c649025f004bf4898d01c5 | 2023-01-25T16:17:54.436Z | Help Fix Code | v1 | null | void fib(int **fib_sequence ,int count){
*fib_sequence = malloc(sizeof(int) * count);
if (count == 1){
*fib_sequence[0] = 0;
} else {
*fib_sequence[0] = 0;
*fib_sequence[1] = 1;
int i;
for (i = 2; i < count; i++){
*fib_sequence[i] = *fib_sequence[i - 1] + *fib_sequence[i -2];
}
}
void fib(int *... | return a array of 10 integers | null |
63c649025f004bf4898d01c5 | 2023-01-25T16:24:48.659Z | Help Fix Code | v1 | null | void fib(int **fib_sequence ,int count){
*fib_sequence = malloc(sizeof(int) * count);
if (count == 1){
*fib_sequence[0] = 0;
} else {
*fib_sequence[0] = 0;
*fib_sequence[1] = 1;
int i;
for (i = 2; i < count; i++){
*fib_sequence[i] = *fib_sequence[i - 1] + *fib_sequence[i -2];
}
}
}
| create an array of length count | null |
63c649025f004bf4898d01c5 | 2023-01-25T17:26:09.279Z | Explain Code | v1 | null | int **split_array(const int *s, int length) {
int i;
int **result = malloc(sizeof(int*)*2);
if (length % 2 !=0){
int *even = malloc(sizeof(int)*(length/2 + 1));
int *odd = malloc(sizeof(int)*(length/2));
} else {
int *even = malloc(sizeof(int)*(length/2));
int *odd = malloc(sizeof(int)*(length/2));
}
... | null | null |
63c649025f004bf4898d01c5 | 2023-01-25T21:04:27.579Z | General Question | v1 | how to create an array of strings where each element is the string representation of an integer
| null | null | null |
63c649025f004bf4898d01c5 | 2023-01-25T21:17:16.349Z | Help Fix Code | v1 | null | int *build_array(char **strs, int size) {
int result[size];
int i;
for (i = 0; i < size; i++){
result[i] = *strs[i];
}
return result;
} | how to return a pointer | null |
63c649025f004bf4898d01c5 | 2023-02-11T17:18:54.297Z | General Question | v1 | how to use time() to get current time
| null | null | null |
63c649025f004bf4898d01c5 | 2023-02-16T21:19:17.149Z | Explain Code | v1 | null | #include <stdio.h>
#define SIZE 4
#define OVERFLOW 4
int main() {
int index = 0;
int i;
int before[SIZE] = {10, 10, 10, 10};
int a[SIZE] = {0, 0, 0, 0};
int after[SIZE] = {10, 10, 10, 10};
printf("Address of the variables:\n");
for (index = 0; index < SIZE; index++) {
printf("%lx ... | null | null |
63c649025f004bf4898d01c5 | 2023-03-12T03:57:28.517Z | General Question | v2 | What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B? | null | null | null |
63c649025f004bf4898d01c5 | 2023-03-16T16:18:35.313Z | General Question | v2 | how to use -vtu4
| null | null | null |
63c649025f004bf4898d01c5 | 2023-03-16T16:28:58.235Z | Help Fix Code | v2 | random generate number between 0 and 99 to a binary file
| int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr, "Usage: write_test_file filename\n");
exit(1);
}
FILE *fp;
if ((fp = fopen(argv[1], "w")) == NULL) {
perror("fopen");
exit(1);
}
int error = 0;
// TODO: complete this program according its de... | null | null |
63c649025f004bf4898d01c5 | 2023-03-23T17:47:16.640Z | Help Write Code | v2 | null | null | null | // Step 1: update inbuf (how many bytes were just added?) |
63c649045f004bf4898d01d4 | 2023-01-17T22:28:08.448Z | General Question | v1 | how to code a web site in C
| null | null | null |
63c649045f004bf4898d01d4 | 2023-01-22T00:29:33.113Z | Explain Code | v1 | null | #include <stdio.h>
#include <stdlib.h>
/*
* Return an array of the squares from 1 to max_val.
*/
int *squares(int max_val) {
int *result = malloc(sizeof(int) * max_val);
int i;
for (i = 1; i <= max_val; i++) {
result[i - 1] = i * i ;
}
return result;
}
int main() {
int *squares_to... | null | null |
63c649045f004bf4898d01d4 | 2023-02-13T22:38:27.331Z | Explain Code | v1 | null | int create_user(const char *name, User **user_ptr_add) {
if(strlen(name) + 1 > MAX_NAME){
return 2;
}
User * current = *user_ptr_add;
User *new_user = malloc(sizeof(User));
if(new_user == NULL){
perror("malloc");
exit(1);
}
new_user->first_post = NULL;
new_us... | null | null |
63c649045f004bf4898d01d4 | 2023-02-13T22:39:57.798Z | Question from Code | v1 | do you think there are any memory leaks here? | int create_user(const char *name, User **user_ptr_add) {
if(strlen(name) + 1 > MAX_NAME){
return 2;
}
User * current = *user_ptr_add;
User *new_user = malloc(sizeof(User));
if(new_user == NULL){
perror("malloc");
exit(1);
}
new_user->first_post = NULL;
new_us... | null | null |
63c649045f004bf4898d01d4 | 2023-02-13T22:42:40.039Z | Question from Code | v1 | do you see any memory leaks now? | int create_user(const char *name, User **user_ptr_add) {
if(strlen(name) + 1 > MAX_NAME){
return 2;
}
User * current = *user_ptr_add;
User *new_user = malloc(sizeof(User));
if(new_user == NULL){
perror("malloc");
free(new_user);
exit(1);
}
new_user->first... | null | null |
63c649045f004bf4898d01d4 | 2023-02-13T22:46:14.337Z | General Question | v1 | how can malloc allocate the memory if it returns NULL? | null | null | null |
63c649045f004bf4898d01d9 | 2023-01-30T18:13:36.139Z | General Question | v1 | How do I use fscanf? | null | null | null |
63c649045f004bf4898d01d9 | 2023-01-30T21:09:06.341Z | General Question | v1 | How to call function from another external c file? | null | null | null |
63d1c5af6dac7d3734e69fce | 2023-01-27T19:41:24.351Z | Question from Code | v1 | what does this code do | int *build_array(char **strs, int size) {
int *ints = (int *)malloc(size * sizeof(int));
for (int i = 0; i < size; i++) {
*(ints + i) = (int)*(strs+i);
}
} | null | null |
63d1c5af6dac7d3734e69fce | 2023-01-27T19:43:28.002Z | Question from Code | v1 | if i input ["32", "10"] what will the outputted array look like
| int *build_array(char **strs, int size) {
int *ints = (int *)malloc(size * sizeof(int));
for (int i = 0; i < size; i++) {
*(ints + i) = (int)*(strs+i);
}
return ints;
} | null | null |
63d1c5af6dac7d3734e69fce | 2023-01-27T19:48:31.858Z | General Question | v1 | is c division, floor division? | null | null | null |
63d1c5af6dac7d3734e69fce | 2023-01-27T21:39:47.088Z | General Question | v1 | how to allocate a pointer to an array of length 2 that contain 2 pointers to arrays | null | null | null |
63d1c5af6dac7d3734e69fce | 2023-01-27T22:14:13.015Z | Question from Code | v1 | what errors are in my code? how to fix?
| int **split_array(const int *s, int length) {
int n;
int counter = 0;
int counter1 = 0;
if (length % 2 == 0) n = length / 2;
else n = length / 2 + 1;
int **nums = (int **)malloc(2 * sizeof(int *));
int *nums = (int *)malloc(n * sizeof(int));
int *(nums + 1) = (int *)malloc((length / 2) * sizeof(int));
... | null | null |
63d1c5af6dac7d3734e69fce | 2023-01-30T17:29:28.286Z | Question from Code | v1 | why is my code giving an abort message after compiling, or maybe there's another error? | int populate_array(int sin, int *sin_array) {
int x = sin;
int count = 0;
while (x >= 1) {
x = x / 10;
count++;
}
if (count != 9) return 1;
char sin_num[10];
sprintf(sin_num, "%d", sin);
//printf("%s\n", sin_num);
for (int i = 0; i < 9; i++) {
sin_array[i] =... | null | null |
63d1c5af6dac7d3734e69fce | 2023-02-15T21:21:25.408Z | Question from Code | v1 | why is there segfault in lines 32-33? | typedef struct user {
char name[MAX_NAME];
char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents.
struct post *first_post;
struct user *friends[MAX_FRIENDS];
struct user *next;
} User;
typedef struct post {
char author[MAX_NAME];
char *contents;
time_t *date;
s... | null | null |
63d1c5af6dac7d3734e69fce | 2023-02-15T21:22:31.128Z | General Question | v1 | why do i need to dynamically allocate strings that are declared like this char *x for example | null | null | null |
63d1c5af6dac7d3734e69fce | 2023-02-15T21:25:21.442Z | Help Fix Code | v1 | null | typedef struct user {
char name[MAX_NAME];
char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents.
struct post *first_post;
struct user *friends[MAX_FRIENDS];
struct user *next;
} User;
typedef struct post {
char author[MAX_NAME];
char *contents;
time_t *date;
s... | fix code so that new_post->contents dynamically allocates so that it doesn't cause segfault
| null |
63d1c5af6dac7d3734e69fce | 2023-03-15T19:53:26.842Z | Question from Code | v2 | why doesn't the if statement ever give true | int n = fork();
if (n == 0) {
char *buffer = malloc(sizeof(char) * MAXLINE);
buffer = args_to_string(act_ptr->args, buffer, get_size(act_ptr->args));
printf("%s\n", buffer);
printf("^^^^^^^^^^^^\n");
execvp(act_ptr->args[0], act_ptr->args);
perror("execvp");
exit(1);
} | null | null |
63d1c5af6dac7d3734e69fce | 2023-03-15T19:54:49.970Z | Question from Code | v2 | will the child process reach inside the if statement? | int n = fork();
if (n == 0) {
char *buffer = malloc(sizeof(char) * MAXLINE);
buffer = args_to_string(act_ptr->args, buffer, get_size(act_ptr->args));
printf("%s\n", buffer);
printf("^^^^^^^^^^^^\n");
execvp(act_ptr->args[0], act_ptr->args);
perror("execvp");
exit(1);
} | null | null |
63d1c5af6dac7d3734e69fce | 2023-03-15T19:56:54.995Z | Question from Code | v2 | but the print message in the if statement is never printed? so this means the child process never reaches inside the if statement | int n = fork();
if (n == 0) {
char *buffer = malloc(sizeof(char) * MAXLINE);
buffer = args_to_string(act_ptr->args, buffer, get_size(act_ptr->args));
printf("%s\n", buffer);
printf("^^^^^^^^^^^^\n");
execvp(act_ptr->args[0], act_ptr->args);
perror("execvp");
exit(1);
} | null | null |
63d1c5af6dac7d3734e69fce | 2023-03-15T20:01:30.388Z | Question from Code | v2 | why is it that in run_make_zero, the ^^^^^^ is never printed, is it possible that other processes run first and that execvp causes them to terminate or what, | void run_make_zero(char *target, Rule *rules) {
printf("***********\n");
int x = 0;
Rule *p = finds_rule(rules, target);
if (p == NULL) {
p = rules;
}
Dependency *ptr = p->dependencies;
if (ptr == NULL) {
return;
}
printf("***********\n");
while (ptr != NULL) {
... | null | null |
63d1c5af6dac7d3734e69fce | 2023-04-04T02:08:58.141Z | General Question | v2 | how to output time in this format,
"Date: Fri Mar 31 18:45:19 2023"
time_t *date; this is what I receive
| null | null | null |
63d1c5d46dac7d3734e6a411 | 2023-03-12T19:21:56.221Z | General Question | v2 | Could you give me a hint on how I can start writing the code for parse_file in assignment 3?
| null | null | null |
63d1c5d46dac7d3734e6a411 | 2023-03-12T19:51:20.813Z | Help Write Code | v2 | null | null | null | read from the open file fp |
63d1c5d46dac7d3734e6a411 | 2023-03-12T19:55:31.941Z | Help Fix Code | v2 | I want to know if I can properly open file fp | /* Read from the open file fp, and create the linked data structure
that represents the Makefile contained in the file.
See the top of pmake.h for the specification of Makefile contents.
*/
Rule *parse_file(FILE *fp) {
// Implement this function and remove the stubbed return statement below.
char arr[10... | null | null |
63d1c5d46dac7d3734e6a411 | 2023-03-12T19:57:56.112Z | Help Fix Code | v2 | I applied the feedback from last time and want to know if this code successfully open file fp | /* Read from the open file fp, and create the linked data structure
that represents the Makefile contained in the file.
See the top of pmake.h for the specification of Makefile contents.
*/
Rule *parse_file(FILE *fp) {
// Implement this function and remove the stubbed return statement below.
char arr[10... | null | null |
63d1c5d46dac7d3734e6a411 | 2023-03-12T19:59:15.363Z | General Question | v2 | how to exit the program in C? | null | null | null |
63d1c5d46dac7d3734e6a411 | 2023-03-12T19:59:50.808Z | Help Write Code | v2 | null | null | null | how to start writing code for parse_file? |
63d1c5d46dac7d3734e6a411 | 2023-03-12T21:58:07.982Z | Help Write Code | v2 | null | null | null | how to read from the open file fp for parse file in Assignment 3 |
63d1c5d46dac7d3734e6a411 | 2023-03-12T21:59:16.847Z | Help Write Code | v2 | null | null | null | what does the code have to look like for parse_file in assignment 3?
|
63d1c5d46dac7d3734e6a411 | 2023-03-12T22:12:29.195Z | Help Write Code | v2 | null | null | null | help me with implementation of parse_file |
63d1c5d46dac7d3734e6a411 | 2023-03-12T22:24:43.208Z | Help Write Code | v2 | null | null | null | please tell me the steps into implementing parse_file in Assignment 3 |
63d1c5d46dac7d3734e6a411 | 2023-03-13T02:45:44.631Z | General Question | v2 | what does the input look like for parse_file in assignment 3? | null | null | null |
63d1c5d46dac7d3734e6a411 | 2023-03-13T03:59:46.208Z | General Question | v2 | what does the output of print_rules looks like for assignment 3? | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.