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=...
robert_x44's user avatar
5 votes
Accepted

What does " 'GetString' is deprecated" mean? How do I fix it?

From the What's new? in CS50 2017 document: CS50 Library To be more consistent with stylistic conventions in C, we’ve renamed the functions in the CS50 Library as follows: GetChar is now get_char ...
DinoCoderSaurus's user avatar
2 votes
Accepted

What's the C equivalent for "string input = GetString();"

If you know in advance how big of a string you are willing to accept, you can put the limit into your scanf argument itself. Try this small program: #include <stdio.h> int main(void) { char ...
curiouskiwi's user avatar
  • 18.6k
2 votes
Accepted

GetString() & Dynamic Memory Allocation

Yes it's true that for simplicity's sake, in the first psets, we din't free() the strings allocated by GetString() and that caused memory leaks. Nevertheless, most modern operating systems can see ...
ChrisG's user avatar
  • 7,376
2 votes

During PSET 2: Substitution, I got an expected expression error for get_string. Please help

Your get_string() has no arguments, while in the lectures we've been taught to always insert a prompt (in the form of a string) in between the parentheses. Try combining these two lines: printf("...
TLH's user avatar
  • 312
1 vote
Accepted

Week 1: get_int & get_string errors

Solved! I ran "update50" in the terminal twice, and after the second time a prompt came up that told me I'm currently running "pip 9.0.1" and there is an update available for "pip 10.0.1", and told ...
Xia Liu's user avatar
  • 19
1 vote

Week 1: get_int & get_string errors

Your line numbers in code and in the error messages don't match, are off by one, so I'd guess you forgot to save, or compiled something else (another file, maybe of the same name in a different ...
Blauelf's user avatar
  • 20.9k
1 vote
Accepted

after running update50, get_string(); fails

ROOT CAUSE: changes to the environment in update50. (Specifically CFLAGS, which changes -std=c11 to -std=gnu11). This affects all the cs50.h get_ functions. It is important to close any and all ...
DinoCoderSaurus's user avatar
1 vote
Accepted

Finding & printing character after space in string in C

the isspace function should return a boolean, whereas you assign a char to the 'return value' of isspace. What you probably want to do is to check if, for every i, the current name[i] is a space, and ...
MrBobJamesBob's user avatar
1 vote

week 1 string.c errors

Be sure to save before making your program!
kzidane's user avatar
  • 17.7k
1 vote

How could you create a dynamic array of strings in C?[Beginner]

You can ask user to separate names with comma or space or some other delimiter. You can find strchr() function useful for parsing names in such an input. Another option is to ask further names in a ...
t.m.'s user avatar
  • 158
1 vote

What's the C equivalent for "string input = GetString();"

Funny thing is that I can't get much to work right in cs50.h so I've just been looking up standard c programming techniques. It's just been much easier to find working examples on the Internet using ...
George Ou's user avatar

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