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
⌀ |
---|---|---|---|---|---|---|---|
63c648b65f004bf4898cfefa
|
2023-02-10T23:05:29.531Z
|
Help Fix Code
|
v1
| null |
struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) {
struct pixel** m = malloc(sizeof(struct pixel *) * height);
for (int i = 0; i < height; i++){
m[i] = malloc(sizeof(struct pixel) * width);
fread(m[i], sizeof(struct pixel), width, image);
}
return m;
}
|
fix
| null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:07:14.754Z
|
Help Fix Code
|
v1
| null |
struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) {
struct pixel** m = malloc(sizeof(struct pixel *) * height);
for (int i = 0; i < height; i++){
m[i] = malloc(sizeof(struct pixel) * width);
fseek(&width, sizeof(struct pixel), pixel_array_offset, image);
fread(m[i], sizeof(struct pixel), width, image);
}
return m;
}
|
fix
| null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:07:47.345Z
|
Question from Code
|
v1
|
how should I be using fseek in this situation
|
struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) {
struct pixel** m = malloc(sizeof(struct pixel *) * height);
for (int i = 0; i < height; i++){
m[i] = malloc(sizeof(struct pixel) * width);
fseek(&width, sizeof(struct pixel), pixel_array_offset, image);
fread(m[i], sizeof(struct pixel), width, image);
}
return m;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:09:20.008Z
|
Help Fix Code
|
v1
| null |
struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) {
struct pixel** m = malloc(sizeof(struct pixel *) * height);
for (int i = 0; i < height; i++){
m[i] = malloc(sizeof(struct pixel) * width);
fseek(image, pixel_array_offset, SEEK_SET);
fread(m[i], sizeof(struct pixel), width, image);
}
return m;
}
|
fix
| null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:09:45.015Z
|
Question from Code
|
v1
|
which position should i seek to
|
struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) {
struct pixel** m = malloc(sizeof(struct pixel *) * height);
for (int i = 0; i < height; i++){
m[i] = malloc(sizeof(struct pixel) * width);
fseek(image, pixel_array_offset, SEEK_SET);
fread(m[i], sizeof(struct pixel), width, image);
}
return m;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:10:27.930Z
|
Help Fix Code
|
v1
| null |
struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) {
struct pixel** m = malloc(sizeof(struct pixel *) * height);
for (int i = 0; i < height; i++){
m[i] = malloc(sizeof(struct pixel) * width);
fseek(image, pixel_array_offset + i * width * sizeof(struct pixel), SEEK_SET);
fread(m[i], sizeof(struct pixel), width, image);
}
return m;
}
|
fix
| null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:16:23.532Z
|
General Question
|
v1
|
how to use free
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-10T23:19:49.949Z
|
Question from Code
|
v1
|
how do you deallocate the dynamically-allocated memory
|
int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr, "Usage: bitmap_printer input_bmp\n");
exit(1);
}
FILE *image = fopen(argv[1], "rb");
if (image == NULL) {
fprintf(stderr, "Cannot open file\n");
exit(1);
}
// Read in bitmap file metadata
int pixel_array_offset, width, height;
read_bitmap_metadata(image, &pixel_array_offset, &width, &height);
// Print out metadata.
printf("Pixel array offset: %d\n", pixel_array_offset);
printf("Width: %d\n", width);
printf("Height: %d\n", height);
// Read in the pixel data
struct pixel **pixels = read_pixel_array(image, pixel_array_offset, width, height);
// Print out some pixels from each of the image's corners.
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
print_pixel(pixels[i][j]);
print_pixel(pixels[i][width - 1 - j]);
print_pixel(pixels[height - 1 - i][j]);
print_pixel(pixels[height - 1 - i][width - 1 - j]);
}
}
// Clean up: you need to do this!
fclose(image);
return 0;
}
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-14T12:55:37.265Z
|
Question from Code
|
v1
|
What will this declaration line become after the program has passed
through the C pre-processor?
|
#define MAXNAME = 32;
char name[MAXNAME];
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-14T12:57:51.186Z
|
Question from Code
|
v1
|
What error does this code give?
|
#define MAXNAME = 32;
char name[MAXNAME];
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-14T13:00:46.832Z
|
Question from Code
|
v1
|
What is the line to compile it into an executable named a.out that it will print the value 5 to stdout?
|
#include <stdio.h>
int main() {
#ifdef MACRO
printf("%d\n", MACRO);
#endif
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-14T13:03:16.404Z
|
Question from Code
|
v1
|
What will cpp give me?
|
#define MAXNAME = 32;
char name[MAXNAME];
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-14T13:05:17.089Z
|
Question from Code
|
v1
|
what will the output be
|
#define SUPERVISOR(regular) regular + 5
int main() {
int regular_pay = 20;
int hours_worked = 10;
printf("pay is %d\n", (hours_worked * SUPERVISOR(regular_pay)));
// rest omitted
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T00:22:59.553Z
|
General Question
|
v1
|
what is **
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T00:24:26.744Z
|
General Question
|
v1
|
how do you check the last element of an array
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T00:28:24.673Z
|
Help Write Code
|
v1
| null | null | null |
Create a new user with the given name. Insert it at the tail of the list
* of users whose head is pointed to by *user_ptr_add.
*
* Return:
* - 0 if successful
* - 1 if a user by this name already exists in this list
* - 2 if the given name cannot fit in the 'name' array
* (don't forget about the null terminator)
|
63c648b65f004bf4898cfefa
|
2023-02-15T00:58:29.475Z
|
General Question
|
v1
|
what does an empty list hold an index 0
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T01:26:10.435Z
|
Help Fix Code
|
v1
| null |
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
int i = 0;
while (user_ptr_add[i] != NULL){
if (*user_ptr_add[i].name == &name){
return 1;
}
i++;
}
struct user new_user;
strcpy(new_user.name, *name);
user_ptr_add[i] = new_user;
return 0;
}
|
how do i fix the compare on line 8
| null |
63c648b65f004bf4898cfefa
|
2023-02-15T01:31:27.182Z
|
Question from Code
|
v1
|
what is the type of user_ptr_add[i] and new_user
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
int i = 0;
while (user_ptr_add[i] != NULL){
if (*user_ptr_add[i]->name == *name){
return 1;
}
i++;
}
struct user new_user;
strcpy(new_user.name, name);
user_ptr_add[i] = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T02:55:42.487Z
|
General Question
|
v1
|
how to case a const int * to int *
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T03:23:58.741Z
|
General Question
|
v1
|
how do you check if a file exists
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T03:46:42.056Z
|
General Question
|
v1
|
how do you use gdb
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T03:57:40.145Z
|
Question from Code
|
v1
|
how do you check if curr is NULL
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// traversing through list
while (curr->next != NULL && curr != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T03:58:20.604Z
|
Question from Code
|
v1
|
how do you check if *user_ptr_add is null
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// traversing through list
while (curr->next != NULL && curr != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T03:58:54.158Z
|
Question from Code
|
v1
|
why am i getting a segmentation fault
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// traversing through list
while (curr->next != NULL && curr != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T13:46:18.443Z
|
General Question
|
v1
|
how do you breakpoint on gdb
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T13:57:44.262Z
|
Question from Code
|
v1
|
what is curr's value on line 13
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// check if list is empty
if (curr == NULL){
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = NULL;
curr = new_user;
return 0;
}
// traversing through list
while (curr->next != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T13:58:46.817Z
|
Question from Code
|
v1
|
how do I make curr = new_user
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// check if list is empty
if (curr == NULL){
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = NULL;
curr = new_user;
return 0;
}
// traversing through list
while (curr->next != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:04:58.678Z
|
Help Fix Code
|
v1
| null |
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// check if list is empty
if (curr == NULL){
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = NULL;
curr = new_user;
printf("%s\n", user_ptr_add->name);
return 0;
}
// traversing through list
while (curr->next != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
|
print the name of the head of the list
| null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:06:20.606Z
|
Help Fix Code
|
v1
| null |
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// check if list is empty
if (curr == NULL){
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = NULL;
curr = new_user;
printf("%s\n", *user_ptr_add->name);
return 0;
}
// traversing through list
while (curr->next != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
|
print the name of the head of the list
| null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:07:15.323Z
|
Question from Code
|
v1
|
why is my print statement giving me an error
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// check if list is empty
if (curr == NULL){
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = NULL;
curr = new_user;
printf("%s\n", *user_ptr_add->name);
return 0;
}
// traversing through list
while (curr->next != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:08:19.113Z
|
Question from Code
|
v1
|
how do i dereference the pointer to access the struct on line 14
|
int create_user(const char *name, User **user_ptr_add) {
if (strlen(name) > 31){
return 2;
}
User *curr = *user_ptr_add;
// check if list is empty
if (curr == NULL){
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = NULL;
curr = new_user;
printf("%s\n", *user_ptr_add->name);
return 0;
}
// traversing through list
while (curr->next != NULL){
// check if name exists
if (curr->name == name){
return 1;
}
curr = curr->next;
}
// creating a new user
User *new_user = malloc(sizeof(User));
strcpy(new_user->name, name);
new_user->next = curr->next;
// insert at end
curr->next = new_user;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:33:02.280Z
|
Question from Code
|
v1
|
what is curr->name
|
User *find_user(const char *name, const User *head) {
User *curr = (User *) head;
// traversing through list
while (curr != NULL){
// check if name matches
if (curr->name == name){
return curr;
}
curr = curr->next;
}
return NULL;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:33:37.458Z
|
Question from Code
|
v1
|
what is name
|
User *find_user(const char *name, const User *head) {
User *curr = (User *) head;
// traversing through list
while (curr != NULL){
// check if name matches
if (curr->name == name){
return curr;
}
curr = curr->next;
}
return NULL;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:42:07.424Z
|
General Question
|
v1
|
"david", '\000' <repeats 26 times>, what does that mean
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:52:42.806Z
|
General Question
|
v1
|
can you put a breakpoint in another file using gdb
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T14:56:22.176Z
|
General Question
|
v1
|
how do you initialize a struct
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T15:00:03.043Z
|
General Question
|
v1
|
is there boolena in c
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T15:04:27.449Z
|
General Question
|
v1
|
how to compare a char array to a string literal in c
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T15:05:42.215Z
|
General Question
|
v1
|
how to compare a char array to a string pointer in c
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T16:14:06.275Z
|
General Question
|
v1
|
how do you find the current time and convert a time value to a string
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T18:02:23.525Z
|
General Question
|
v1
|
how do you print from a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T18:02:56.853Z
|
General Question
|
v1
|
how to read a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T18:15:43.421Z
|
General Question
|
v1
|
how to scan from a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T18:43:58.467Z
|
General Question
|
v1
|
how to have one argument of strcmp be null
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T18:45:43.327Z
|
Question from Code
|
v1
|
what is the type of user->profile_pic
|
int print_user(const User *user) {
if (user == NULL){
return 1;
}
int i = 0;
Post *curr = user->first_post;
char *time_string;
FILE *profile_pic;
char row[45];
// print profile pic
printf("%d\n", (strcmp(NULL, user->profile_pic) == 0));
if (user->profile_pic == NULL){
profile_pic = fopen(user->profile_pic, "r");
while (fscanf(profile_pic, "%s", row) != EOF){
printf("%s\n", row);
}
}
// print name
printf("Name: %s\n", user->name);
// dashes
printf("------------------------------------------\n");
// print friends
printf("Friends:\n");
while (user->friends[i] != NULL){
printf("%s\n", user->friends[i]->name);
i++;
}
//print posts
printf("------------------------------------------\n");
printf("Posts:\n");
while (curr != NULL){
time_string = ctime(curr->date);
printf("From: %s\n", curr->author);
printf("Date: %s\n", time_string);
printf("%s\n", curr->contents);
curr = curr->next;
if (curr != NULL){
printf("\n===\n");
}
}
printf("------------------------------------------\n");
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T18:46:47.837Z
|
Question from Code
|
v1
|
why doesn't my compare work on line 14
|
int print_user(const User *user) {
if (user == NULL){
return 1;
}
int i = 0;
Post *curr = user->first_post;
char *time_string;
FILE *profile_pic;
char row[45];
// print profile pic
printf("%d\n", (strcmp(NULL, user->profile_pic) == 0));
if (user->profile_pic == NULL){
profile_pic = fopen(user->profile_pic, "r");
while (fscanf(profile_pic, "%s", row) != EOF){
printf("%s\n", row);
}
}
// print name
printf("Name: %s\n", user->name);
// dashes
printf("------------------------------------------\n");
// print friends
printf("Friends:\n");
while (user->friends[i] != NULL){
printf("%s\n", user->friends[i]->name);
i++;
}
//print posts
printf("------------------------------------------\n");
printf("Posts:\n");
while (curr != NULL){
time_string = ctime(curr->date);
printf("From: %s\n", curr->author);
printf("Date: %s\n", time_string);
printf("%s\n", curr->contents);
curr = curr->next;
if (curr != NULL){
printf("\n===\n");
}
}
printf("------------------------------------------\n");
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T19:04:34.758Z
|
General Question
|
v1
|
*** stack smashing detected ***: terminated what does this mean
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T19:11:52.858Z
|
Question from Code
|
v1
|
why am i getting this error *** stack smashing detected ***: terminated
|
int print_user(const User *user) {
if (user == NULL){
return 1;
}
int i = 0;
Post *curr = user->first_post;
char *time_string;
FILE *profile_pic;
char row[45];
// print profile pic
if (strcmp("\0", user->profile_pic) != 0){
profile_pic = fopen(user->profile_pic, "rb");
while (fread(row, sizeof(char) * 20, 20, profile_pic) != 0){
printf("%s\n", row);
}
}
// print name
printf("Name: %s\n", user->name);
// dashes
printf("------------------------------------------\n");
// print friends
printf("Friends:\n");
while (user->friends[i] != NULL){
printf("%s\n", user->friends[i]->name);
i++;
}
//print posts
printf("------------------------------------------\n");
printf("Posts:\n");
while (curr != NULL){
time_string = ctime(curr->date);
printf("From: %s\n", curr->author);
printf("Date: %s\n", time_string);
printf("%s\n", curr->contents);
curr = curr->next;
if (curr != NULL){
printf("\n===\n");
}
}
printf("------------------------------------------\n");
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T19:21:33.862Z
|
Question from Code
|
v1
|
how do you determine the arguments for fread
|
int print_user(const User *user) {
if (user == NULL){
return 1;
}
int i = 0;
Post *curr = user->first_post;
char *time_string;
FILE *profile_pic;
char row[45];
// print profile pic
if (strcmp("\0", user->profile_pic) != 0){
profile_pic = fopen(user->profile_pic, "rb");
while (fread(row, sizeof(char) * 20, 20, profile_pic) != 0){
printf("%s\n", row);
}
}
// print name
printf("Name: %s\n", user->name);
// dashes
printf("------------------------------------------\n");
// print friends
printf("Friends:\n");
while (user->friends[i] != NULL){
printf("%s\n", user->friends[i]->name);
i++;
}
//print posts
printf("------------------------------------------\n");
printf("Posts:\n");
while (curr != NULL){
time_string = ctime(curr->date);
printf("From: %s\n", curr->author);
printf("Date: %s\n", time_string);
printf("%s\n", curr->contents);
curr = curr->next;
if (curr != NULL){
printf("\n===\n");
}
}
printf("------------------------------------------\n");
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T19:23:38.194Z
|
General Question
|
v1
|
how can you get the number of elements within a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T19:54:48.534Z
|
General Question
|
v1
|
how do you remove an element from an array
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T20:53:51.127Z
|
General Question
|
v1
|
how do you use time and ctime
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T21:24:17.615Z
|
Help Fix Code
|
v1
| null |
int make_post(const User *author, User *target, char *contents) {
if (author == NULL || target == NULL){
return 2;
}
else if (are_friends(author, target) == 0){
return 1;
}
// creating a new post
Post *new_post = malloc(sizeof(Post));
strcpy(new_post->author, author->name);
new_post->contents = contents;
new_post->date = time(NULL);
new_post->next = target->first_post;
target->first_post = new_post;
return 0;
}
|
fix line 14
| null |
63c648b65f004bf4898cfefa
|
2023-02-15T21:24:57.634Z
|
Question from Code
|
v1
|
how do i make new_post->date the current time
|
int make_post(const User *author, User *target, char *contents) {
if (author == NULL || target == NULL){
return 2;
}
else if (are_friends(author, target) == 0){
return 1;
}
// creating a new post
Post *new_post = malloc(sizeof(Post));
strcpy(new_post->author, author->name);
new_post->contents = contents;
new_post->date = time(NULL);
new_post->next = target->first_post;
target->first_post = new_post;
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T21:25:28.182Z
|
Help Fix Code
|
v1
| null |
int make_post(const User *author, User *target, char *contents) {
if (author == NULL || target == NULL){
return 2;
}
else if (are_friends(author, target) == 0){
return 1;
}
// creating a new post
Post *new_post = malloc(sizeof(Post));
strcpy(new_post->author, author->name);
new_post->contents = contents;
new_post->date = time(NULL);
new_post->next = target->first_post;
target->first_post = new_post;
return 0;
}
|
how do i make new_post->date the current time
| null |
63c648b65f004bf4898cfefa
|
2023-02-15T21:25:56.583Z
|
General Question
|
v1
|
how do i get the current time
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T21:27:07.085Z
|
General Question
|
v1
|
Use the time and ctime functions to find the current time and convert a time value to a string,
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-15T21:28:37.027Z
|
General Question
|
v1
|
what is & for
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-17T18:30:04.393Z
|
General Question
|
v1
|
how do i put null terminator at the end of a string
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-17T18:31:33.351Z
|
General Question
|
v1
|
how do i put null terminator at the end of a string using memset
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-17T18:36:10.393Z
|
Question from Code
|
v1
|
why does dest not properly null terminate
|
char *copy(char *dest, const char *src, int capacity) {
for (int i = 0; i < capacity; i++){
if (&src[i] != NULL){
dest[i] = src[i];
}
else{
dest[i] = '\0';
break;
}
}
return dest;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-17T18:37:15.916Z
|
Question from Code
|
v1
|
how do i get the value of src
|
char *copy(char *dest, const char *src, int capacity) {
for (int i = 0; i < capacity; i++){
if (src[i] != NULL){
dest[i] = src[i];
}
else{
dest[i] = '\0';
break;
}
}
return dest;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-02-17T18:40:11.242Z
|
General Question
|
v1
|
what is a null terminator
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-23T23:20:45.663Z
|
General Question
|
v1
|
you can run man 2 wait to learn about the wait system call. Which macro is used with wait's status to check if the child process was terminated by a signal?
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-02-23T23:21:40.100Z
|
General Question
|
v1
|
What is the name for a child process whose parent terminates before it does?
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-03T16:20:18.730Z
|
General Question
|
v1
|
what is fork
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:12:32.271Z
|
General Question
|
v2
|
what is dup2
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:17:00.294Z
|
General Question
|
v2
|
how to open a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:21:35.229Z
|
General Question
|
v2
|
how do you make an exec call
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:28:12.028Z
|
General Question
|
v2
|
how to use fopen
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:34:54.477Z
|
General Question
|
v2
|
what is dup2
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:50:33.326Z
|
General Question
|
v2
|
what is write
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T20:51:03.087Z
|
General Question
|
v2
|
what is wait
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-10T21:23:16.766Z
|
General Question
|
v2
|
what is WIFEXITED
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:00:49.852Z
|
Question from Code
|
v2
|
What does the program print to stderr when it runs without interruption?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:01:37.055Z
|
Question from Code
|
v2
|
What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position A?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:03:20.561Z
|
Question from Code
|
v2
|
What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position c?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:07:30.819Z
|
Question from Code
|
v2
|
What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:23:44.440Z
|
Question from Code
|
v2
|
what is the value of sigint at position b?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:34:31.771Z
|
Question from Code
|
v2
|
What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position b?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
fprintf(stderr, SIGINT);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:36:26.665Z
|
General Question
|
v2
|
how do you get a sigint
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:38:41.532Z
|
Help Fix Code
|
v2
|
send a sigint after line 16
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT,&act,NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:40:28.105Z
|
Help Write Code
|
v2
| null | null | null |
send a sigint after line 16
|
63c648b65f004bf4898cfefa
|
2023-03-14T03:41:38.747Z
|
Question from Code
|
v2
|
what is printed
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
kill(2);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T03:56:46.458Z
|
Question from Code
|
v2
|
What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position a?
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T04:14:05.094Z
|
Explain Code
|
v2
| null |
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-14T04:23:25.538Z
|
Question from Code
|
v2
|
what is printed
|
int x = 5;
void handler(int sig) {
x += 3;
fprintf(stderr, "inside %d ", x);
}
int main() {
fprintf(stderr, "start ");
// POSITION A
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaction(SIGINT, &act, NULL);
kill - INT;
// POSITION B
x += 2;
// POSITION C
fprintf(stderr, "outside %d", x);
return 0;
}
| null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T14:52:28.040Z
|
General Question
|
v2
|
how to run a make file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T15:14:09.321Z
|
General Question
|
v2
|
what does this mean : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T15:23:19.488Z
|
General Question
|
v2
|
how to read from a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T15:30:26.482Z
|
General Question
|
v2
|
set a string array
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T15:32:12.009Z
|
General Question
|
v2
|
how to set a string array to empty
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T15:34:55.992Z
|
General Question
|
v2
|
how do you get the last value of a line from a file
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T15:41:18.613Z
|
General Question
|
v2
|
how do you use strtok
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T16:22:49.852Z
|
General Question
|
v2
|
what does strtok return if delim in no there
| null | null | null |
63c648b65f004bf4898cfefa
|
2023-03-15T16:32:53.935Z
|
General Question
|
v2
|
how to read line by line from the end of the file
| null | null | null |
63c648b75f004bf4898cff04
|
2023-01-17T20:20:34.449Z
|
General Question
|
v1
|
how to print in c
| null | null | null |
63c648b75f004bf4898cff04
|
2023-01-19T18:33:18.704Z
|
General Question
|
v1
|
while loop that runs until there is user input in scanf
| null | null | null |
63c648b75f004bf4898cff04
|
2023-01-26T23:16:07.678Z
|
General Question
|
v1
|
how to create malloc starting at a given pointer
| null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.