Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 12099
1 vote
Accepted

Declaring an array of structure pointers

If your struct is for example struct node, an array of pointers would be for example struct node *myarray[ARR_LENGTH] (assuming ARR_LENGTH to be a constant meaning the array length) If you typedef'd your …
Blauelf's user avatar
  • 21k
1 vote
Accepted

Pset4 - Array declaration- Heap

Arrays you declare as int array[42]; are stored on stack, like any other variable. … For arrays like int *array = (int*)malloc(42*sizeof(int));, a pointer array is stored on stack, the memory block of 42 ints is allocated on the heap. Don't confuse those two parts. …
Blauelf's user avatar
  • 21k
1 vote
Accepted

Pset2: Copying string contents

You declare ky as string[keylen], it should be char[keylen+1] (don't forget the null terminator, that's why +1). Don't forget to check argc before accessing argv[1], it might not exist at all. Don't …
Blauelf's user avatar
  • 21k
1 vote
Accepted

Pset5 Dictionary C Struct Array Call In Load Function Issue

fscanf needs some memory to write to, so char word[LENGTH + 1]; is probably the way to go. You might want to strcpy the result to a new node's word property in case of success. Please note that the l …
Blauelf's user avatar
  • 21k
0 votes

CS50 PSET2 code will not compile

No array length. Third, as argv is a list of strings, with the number of strings stored in argc. …
Blauelf's user avatar
  • 21k
0 votes

Why am I able to insert an element into a hash tree via Main() but not via a function call?

In C, all function parameters are passed by value, that is the values are copied into the parameters. (There a way to pass by reference instead, but I think that one makes code hard to read.) So when …
Blauelf's user avatar
  • 21k