Questions tagged [null]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Pset4 Recovery Produces Corrupt Null Files & Skips An Image

I've been working at recovery for a while - I believe I'm nearly done with it - but right now my code is giving me serious problems. Currently, running ./recover card.raw produces 49 of the 50 images (...
0
votes
2answers
58 views

Week 2 CRACK: Erratic behavior with NULL '\0' when printing combinations of letters

I want to iterate through all possible combinations of the alphabet, including single letter outputs. For this purpose I included the use of '\0' so the first print out in the iteration is the sigle ...
0
votes
1answer
250 views

pset2 Vigenere null pointer passed as argument 1, which is declared to never be null

So as stated in the title, my problem is that a null pointer is being passed to something in my Vigenere encoder. Here is my code. I will explain what I find to be the problem and give the error ...
0
votes
1answer
119 views

CS50 Pset4 Recover card.raw only NULL

Okay so I am starting the recover program from Pset4 and I initially just want to get some output, any output, I have been trying to read the first few bytes from recover.raw but for some reason seem ...
0
votes
1answer
39 views

When do I nul terminate strings?

I'm on week 4 and looking over other people's codes and I've noticed that up to this point, I've never really nul-terminated strings with '\0'. From what I understand, there are some functions where ...
0
votes
1answer
56 views

Speller Trie Seg fault in Unload()

I have implemented load, check, and unload for dictionary.c using trie, and I am suffering a segmentation fault. The error happens inside load function, or, to be more precise, inside the function ...
0
votes
1answer
40 views

Speller.c fp is NULL

I am done implementing load and check, so I wanted to check it. According debug50, load gives me a boolean value of true, but when speller.c (which was distributed) attempts to open the text file, fp =...
0
votes
1answer
104 views

String validity check when string is command line argument?

We check the string validity when we use the get_string() function. Example: if (p != NULL) Are we also supposed to check string validity when the string is entered as a command line argument?
0
votes
1answer
1k views

What does time(NULL) mean when used with srand48?

What does time(NULL) mean in the following : srand48((long int)time(NULL)) ? I see it being used in srand48 when we don't want a seed value.
0
votes
1answer
81 views

Pset 2 Caesar Strange Issues

I'm having some issues with Caesar. I can't seem to find anything wrong with my code, however, when I run the program, it prints things that seem to make no sense. When I run check50 on it, it's ...
0
votes
1answer
121 views

Pointers and End of File in Recover.c

recover.c seems to be working just fine. But then I realized I didn't employ a condition which tests the end of file. Why does it still work then? Should I modify my while condition? In addition to ...
0
votes
1answer
81 views

pset4 Recover Cant figure out why jpeg file pointer gets reset to NULL.

Using Error messages and gdb I figured out why I wasnt getting segfaults- img pointer - to the current jpeg file gets set to NULL. Are my loops all wrong? Im getting myself pretty confused. Code ...
0
votes
1answer
37 views

Is there a difference between 'NULL' and '\0'?

To put this in context, I'm looking at question 23 of Quiz 0 Fall 2014 (http://cdn.cs50.net/2014/fall/quizzes/0/key0.pdf) (Don't click the link if you don't want to see the solution! The question is ...
0
votes
0answers
54 views

Small question with how NULL works

this is just a small question on NULL. In the snippet below, why doesn't the do-while loop repeat when I don't enter anything for the string? #include <stdio.h> #include <string.h> #...
0
votes
0answers
64 views

Initializing a variable in a struct, then in a function

It won't allow me to initialize the array to NULL in the struct in the header file: typedef struct frog { bool is_frog; struct frog* french_chef[10]; // eg = {NULL}; } frog; which I get, but ...
1
vote
1answer
18 views

Bang and Structs

I was hoping someone could clear this up for me, the searches seem to be ignoring the bang. If I put while(!NULL) { // do this } would that be equivalent to saying continue doing this while the ...
0
votes
1answer
407 views

Bad pointer null assignment followed by malloc fail — WHY?

I'm stumped! In dictionary.c I have coded the load function (with more code that follows the bug, but not needed for this question.) One small block of code is producing a problem! Assigning NULL to ...