Hot answers tagged

6 votes
Accepted

Crack - launching and crypt function

crypt() is an encryption algorithm. It takes a plaintext string (a user password), and encrypts it, so that it can be stored in a file. char *crypt(const char *key, const char *salt) The key ...
user avatar
5 votes
Accepted

Week 1 compiling String.c using clang instead of make

The make utility actually calls the clang compiler with special options that can be set for a project. When I run make in the ide it actually runs the following: clang -fsanitize=integer -fsanitize=...
user avatar
3 votes
Accepted

What does -std=c99 command do?

The C programming language has many versions. -std=c99 lets the compiler know that we're using the standard version C99 (released in 1999). See more: http://en.m.wikipedia.org/wiki/C99
user avatar
  • 17.4k
3 votes

error to run all my programs

It looks like you are trying to compile the program (make hello). To run the program the command is usually something like ./hello.
user avatar
3 votes
Accepted

cc or clang and GNU make utility

cc is typically an alias to gcc in Debian systems as far as I know. both gcc and clang are C compilers. a lot of source codes only compile correctly with CC value set to clang. well, for the ...
user avatar
  • 17.4k
2 votes
Accepted

What does flag -o stands for in clang?

It is , as Kareem stated, output file. If you type man clang in the terminal, you can find the following: -o file Write output to file. And pretty much everything about clang, including ...
user avatar
  • 309
2 votes
Accepted

Nothing to be done for `adder'

Make sure the file named adder has the extension .c. Also make sure you're executing this command make adder NOT make adder.c
user avatar
  • 17.4k
2 votes
Accepted

what does '-Wall' flag in the clang mean?

-Wall means to enable all compiler warnings. And -Werror means treat all warnings as errors. In other words, any possible warning that the compiler has determined will be shown to you if your code ...
user avatar
  • 18.4k
2 votes

Why "make" doesn't throw error when I include some libraries like "string.h"?

First, .h files are not libraries. Rather, they're libraries' header files. More on that here! The string library, as @Hassan Javed said, is part of the C standard library. And it's linked by default. ...
user avatar
  • 17.4k
2 votes

What do these Check50 errors mean?

:( greedy.c compiles \ expected an exit code of 0, not standard error of "greedy.c:7:4: error: expected identifie..." That frown :( and the fact that it is displayed in red means that your code ...
user avatar
  • 18.4k
2 votes
Accepted

automatically link cs50 when using make? - not using appliance

cs50.h is a header file. Header files are NOT linked. They are included. What is linked is a library binary file. If you have successfully installed the cs50 library according to the instructions ...
user avatar
  • 17.4k
2 votes

No such file or directory, pset1

It looks as though you don't have a full understanding of how directory structure works. Looking at the image that you posted, you have already created the subdirectory pset1 in the directory ~/...
user avatar
  • 64.2k
2 votes
Accepted

Problem Set 1 help, clang hello.c, and ls (list)

Ahh I figured it out! Instead of using ~/pset1/hello/ $ go back to just the directory pset by using change directory ~/pset1/hello/ $ cd ~/pset1/ then add your ls command ~/pset1/ $ ls hello/ ...
user avatar
1 vote

clang-7: error: linker command failed with exit code 1 (use -v to see invocation

Try saying make then the name u want ur file to be called ex- make hello in the terminal
user avatar
1 vote

CS50.h library in ubuntu

Are you using CS50 ide ? #include <cs50.h> This library will only work if you use CS50 ide for compiling your code, otherwise it will not compile
user avatar
1 vote

bash: clang: command not found

"after I press Run." This doesn't sound like you are using the CS50 IDE (http://cs50.io). Or, if you are, you may not have created it using the CS50 template. If you think that's the case, here ...
user avatar
  • 18.4k
1 vote
Accepted

In pset2, Vigenere, I made and used an array that I would like for it to be explained

The detail you seem to miss is that a char array is not a string unless it ends in the NUL char '\0' If you have char text[] = "Foobar";, that is stored {'F', 'o', 'o', 'b', 'a', 'r', '\0'} ...
user avatar
  • 18.4k
1 vote
Accepted

recover.c:43:34: error: use of undeclared identifier 'out' fwrite(temp, 1, 512, out);: WHAT?

The variable out is a local variable and in C the local variables are block scoped and hence the variable out in this case only exists within the block; { sprintf(fname, "%03i.jpg", fileCount); ...
user avatar
1 vote
Accepted

pset1, Cash, having problem in a single test case 4.2

When you write d -= 0.01; do you mean d -= 1; ? Also, consider rounding after multiplication with 100. Decimal numbers like 4.2 might seem easy to write as a decimal number, but in binary that's ...
user avatar
  • 20.7k
1 vote
Accepted

Clang error with compiling code

I found out my problem. After a closer look at the Makefile, I realized that I only needed to type "make" into the terminal to compile all programs in speller, not make dictionary as I was doing.
user avatar
  • 182
1 vote
Accepted

Pset5 speller - load clang error (linker command error) and multiple definition

True, the function is defined once in dictionary.h. However, the compiler sees that definition twice, the first time when it encounters #include "dictionary.h" in speller (notice the reference to ...
user avatar
1 vote
Accepted

Setting up clang on ubuntu pc

The C libraries used by CS50 are all included in a default installation (std*.h, string.h, ctype.h and so on), except cs50.h of course, which you can find instructions on how to use and download and ...
user avatar
  • 1,223
1 vote
Accepted

control may reach end of non-void function... but not really

It's not so much that compilers are overly cautious, it's that they're stupid and can't actually think. While it may be logically impossible to get through the function without hitting a return ...
user avatar
  • 64.2k
1 vote

Clang error while compiling find

Here's an answer to a similar problem from FaceBook: I am getting a problem in pset3. whenever i try to compile "find.c" The error goes like this: jharvard@appliance (~/Dropbox/pset3): ls ...
user avatar
1 vote
Accepted

what is the funny symbol printed when char[] uninitialized

That's a non-alpha ASCII value that is attempting to be printed. If you really want to know what it is, try printing it as an integer. Something along the lines of printf("the char ascii value is %i\...
user avatar
  • 64.2k
1 vote

Problem with cs50.h header file!

I solved the cs50.h problem by updating my appliance. For updating open the terminal in the appliance and type-- update50 After the process is completed, cs50.h will work..
user avatar
1 vote

What does -std=c99 command do?

adding further , this version of C has many cool new features which every programmer uses presently , like - single line comments starting with // initialising varibales where they are implemented-...
user avatar
1 vote

Why "make" doesn't throw error when I include some libraries like "string.h"?

String.h is a part of the C standard library. So it is automatically linked by the compiler without setting a -lstring flag.This is why you don't see an error.
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible