Questions tagged [getstring]
The getstring tag has no usage guidance.
16 questions
-1
votes
1
answer
1k
views
get_string() C function not working
I just began CS50 and was trying to copy some of the examples done on the lecture video. I use opensuse tumbleweed(also a little new to it) and I had installed the cs50 c library just as the ...
0
votes
2
answers
53
views
get_string prints out special characters as prompt
Here's my code-
#include <cs50.h>
int main(void)
{
string x = get_string("hello");
}
pretty simple, and I compile it with clang -lcs50 test.c -o hello
no error generated, but ...
0
votes
1
answer
362
views
During PSET 2: Substitution, I got an expected expression error for get_string. Please help
substitution.c:24:23: error: expected expression
char* plaintext = get_string();
^
/usr/include/cs50.h:109:53: note: expanded from macro 'get_string'
#define get_string(...) ...
0
votes
3
answers
4k
views
Week 1: get_int & get_string errors
Fro the files int.c and string.c, I copied the code from the lecture exactly, and was receiving errors, then modified the code according to suggestions online by adding #include <cs50.h>and I'm ...
0
votes
2
answers
176
views
Is there a limit to get_string()
I am new to CS50 and teaching AP Comp Sci Principles for the first time this school year. One of my students asked it there was a limit to the amount of bits get_string() can store. I wasn't sure what ...
3
votes
1
answer
902
views
Week 1 compiling String.c using clang instead of make
in week 1 as I understood :
make= compile the file and name the compiled file with the same name.
clang= compile the file with the default name.
when I've used make it worked and when I used clang it ...
3
votes
1
answer
4k
views
What does " 'GetString' is deprecated" mean? How do I fix it?
I have encountered a really confusing error that deals with the "GetString();" function. I tried to google what does this error message mean but haven't had any luck finding a solution. I don't think ...
0
votes
1
answer
518
views
after running update50, get_string(); fails
I was working on Vigenère for pset2, when I was prompted to run update50.
After the update completed,
string = plaintext = get_string();
failed with the following error:
vigenere.c:22:24: error: ...
0
votes
1
answer
2k
views
Finding & printing character after space in string in C
I've been banging my head against a wall here for days, trying to print initials after user name input. The errors change continually and are many. I'm trying to name the string array 'name' then ...
0
votes
1
answer
116
views
week 1 string.c errors
I am going through week 1, and once I enter this:
#include <cs50.h>
#include <stdio.h>
int main(void)
{
string name = get_string();
...
1
vote
1
answer
4k
views
strcmp always returns 0, even with different strings. Week4
Working through the CS50 pages, I decided to do this locally on my Linux Mint computer (gcc --version gets me: gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4).
At the start, I did not realize that cs50.c ...
0
votes
1
answer
205
views
How could you create a dynamic array of strings in C?[Beginner]
How do you create a dynamic array of strings? Like if I had this code
printf("What are the names of your pets?");
what piece of code would I write to get multiple string answers from the user?
(I'm ...
3
votes
2
answers
15k
views
What's the C equivalent for "string input = GetString();"
I am trying to become less dependent on the cs50.h library. I have tried different combinations to replace this line string input = GetString(); but I can't get anything working. Compiler keeps ...
1
vote
1
answer
80
views
GetString() & Dynamic Memory Allocation
I observed in a walkthrough video in Week 4 (structs-0, I believe) David mentions that any variable created with GetString() should be free()d after its usage, due to the fact that, I vaguely quote ...
0
votes
0
answers
59
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
1
answer
1k
views
Problem with Getstring
I don't know what is the problem here when Ι write make hello
umerkhan951@ide50:~/workspace/new $ make hello
clang -ggdb3 -O0 -std=c99 -Wall -Werror hello.c -lcs50 -lm -o hello
hello.c:8:21: ...