Questions tagged [function]

The tag has no usage guidance.

8 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
185 views

example positive.c explanation of function

1. // Abstraction and scope 2. 3. #include <cs50.h> 4. #include <stdio.h> 5. 6. int get_positive_int(string prompt); 7. 8. int main(void) 9. { 10. int ...
0
votes
1answer
11 views

when I compile my program this bug appear. error: control may reach end of non-void function [-Werror,-Wreturn-type] }

bool check_valid_key (string s) { for (int i = 0, len = strlen(s); i < len; i++) { if (!isdigit(s[1])) return false; return true; } }
0
votes
0answers
605 views

speller.c:217:5: error: redefinition of 'main' int main

I actually received two error messages: speller.c:217:5: error: redefinition of 'main' int main(int argc, char *argv[]) ^ speller.c:20:5: note: previous definition is here int main(int argc, ...
0
votes
1answer
18 views

Breakout / pause(function) slows the paddle

When I add pause(5) to the while loop, pause function makes the ball not zip around, it also seems to slow down the paddle responsiveness. What do I have to do to get around that? I do understand why ...
0
votes
0answers
135 views

pset5-Testing load function separately2

I have been trying to test load function separately (Using Zamyla video for some guidance). I have watched this tape several times, but still unable to load function without compiler errors. I am ...
0
votes
0answers
99 views

pset5 load function mallocs more new then i expected, am i building the trie wrong?

With the answer and tips from Cliff B i've managed to stop segfaults and loosing data in the memory, but still unsure about trie implementation. Here's the current code: bool load(const char* ...
0
votes
0answers
186 views

Problem using a function to manipulate strings in pset6 server

This given code in server.c gets the slice of string up to an appearance of \n. const char* haystack = request; char* needle = strstr(haystack, "\r\n"); if (needle == NULL) { ...
0
votes
0answers
305 views

Swap function in helpers.c file

I have successfully completed the linear search and sort functions in the helpers.c file for problem set 3. I included the swapping steps within the sort function directly and everything worked ...