Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: purpose of parameter value of -1 ? Pin
CPallini11-Feb-24 4:12
mveCPallini11-Feb-24 4:12 
QuestionUsing /bin/sh "partially " works Pin
Salvatore Terress9-Feb-24 6:10
Salvatore Terress9-Feb-24 6:10 
AnswerRe: Using /bin/sh "partially " works Pin
Mircea Neacsu9-Feb-24 6:47
Mircea Neacsu9-Feb-24 6:47 
AnswerRe: Using /bin/sh "partially " works Pin
k50549-Feb-24 6:59
mvek50549-Feb-24 6:59 
AnswerRe: Using /bin/sh "partially " works Pin
jschell9-Feb-24 12:29
jschell9-Feb-24 12:29 
QuestionConcurrent linked list Pin
cod3Ninj47-Feb-24 23:40
cod3Ninj47-Feb-24 23:40 
AnswerRe: Concurrent linked list Pin
jschell9-Feb-24 12:32
jschell9-Feb-24 12:32 
Questionget_string memory leak? Pin
mike74115-Feb-24 9:57
mike74115-Feb-24 9:57 
I am taking Harvard's CS50 class. We are learning C.

They use their own library where you include cs50.h.

There is a function called get_string that returns a string.

I think it has a memory leak.

I think this is the source code:

https://github.com/cs50/libcs50/blob/main/src/cs50.c

They are saying stuff like:

string name = get_string("What is your name?");

Then, they never call free on the memory in main.

Anyone know how the memory gets freed or if it is a leak?

Thanks.
AnswerRe: get_string memory leak? Pin
Dave Kreskowiak5-Feb-24 10:03
mveDave Kreskowiak5-Feb-24 10:03 
GeneralRe: get_string memory leak? Pin
Mircea Neacsu5-Feb-24 14:13
Mircea Neacsu5-Feb-24 14:13 
GeneralRe: get_string memory leak? Pin
mike74115-Feb-24 20:05
mike74115-Feb-24 20:05 
GeneralRe: get_string memory leak? Pin
Mircea Neacsu5-Feb-24 20:22
Mircea Neacsu5-Feb-24 20:22 
GeneralRe: get_string memory leak? Pin
Dave Kreskowiak6-Feb-24 4:39
mveDave Kreskowiak6-Feb-24 4:39 
GeneralRe: get_string memory leak? Pin
Mircea Neacsu6-Feb-24 6:59
Mircea Neacsu6-Feb-24 6:59 
GeneralRe: get_string memory leak? Pin
Dave Kreskowiak6-Feb-24 12:22
mveDave Kreskowiak6-Feb-24 12:22 
GeneralRe: get_string memory leak? Pin
Mircea Neacsu6-Feb-24 12:28
Mircea Neacsu6-Feb-24 12:28 
AnswerRe: get_string memory leak? Pin
jschell6-Feb-24 5:02
jschell6-Feb-24 5:02 
GeneralRe: get_string memory leak? Pin
k50546-Feb-24 5:15
mvek50546-Feb-24 5:15 
GeneralRe: get_string memory leak? Pin
RedDk6-Feb-24 10:06
RedDk6-Feb-24 10:06 
GeneralRe: get_string memory leak? Pin
jschell7-Feb-24 5:22
jschell7-Feb-24 5:22 
GeneralRe: get_string memory leak? Pin
charlieg12-Feb-24 23:04
charlieg12-Feb-24 23:04 
Question"connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress3-Feb-24 15:01
Salvatore Terress3-Feb-24 15:01 
SuggestionRe: "connect" with "lambda" C++ code analysis , please. Pin
k50543-Feb-24 15:55
mvek50543-Feb-24 15:55 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress3-Feb-24 16:44
Salvatore Terress3-Feb-24 16:44 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50544-Feb-24 4:34
mvek50544-Feb-24 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.