Skip to main content
3 votes
Accepted

Vigenere Segmentation understanding

This is a very, very common error for new programmers. The problem is the actual call to isalpha(). The isalpha() function takes a single char as input, but argv[1] is a string, not a char. Simply ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

PSET2 Vigenere: Output bug, keyword loop going over strlen of key

There are a number of problems with this code. Let's deal with your question first. The code is constructed as a nested pair of loops. The outer for loop will loop over the length of the plain text ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Nothing prints in Mario Problem

You have set up the while condition incorrectly. Your do/while loop is this: do { ... } while (h>=1 || h<=8); You have essentially created an infinite loop. Think about the test ...
Cliff B's user avatar
  • 69k
1 vote

PSET2 Vigenere: Output bug, keyword loop going over strlen of key

I would recommend you to do this problem set in one for loop. You can just loop through the plaintext. Using nested loops will make the problem more complicates than you think. It's because you only ...
Jn Wu's user avatar
  • 55
1 vote
Accepted

Why is condition being ignored?

The problem is that the function get_pyramid_steps is never called by anything in main. It might as well not be there. If this answers your question, please click on the check mark. Let's keep up on ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Struggling with hash table! Pset5

new->word = dWord; I'd say that the address of dWord is being copied into the pointer(s) new->word for every node created, and not the actual word. When every word is processed, it is written ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

pset3 find less comfortable if else expression result unused

There is no single thing called else if in the C language. The syntax of if is one of: if ( expression ) statement if ( expression ) statement else statement The construct if (condition1) ...
Antti Haapala's user avatar
1 vote
Accepted

Will the loop break in case the condition returns some value to the caller method in C?

"Will the loop break?" Technically speaking, no, it won't break. By using a return true statement, the entire function will immediately terminate and return a value of true to the calling code (or if ...
Cliff B's user avatar
  • 69k
1 vote

Will the loop break in case the condition returns some value to the caller method in C?

Yes, It will. By return keyword your program will be out of current function's scope. So it will be out of that loop.
t.m.'s user avatar
  • 158
1 vote

PS1 greedy question regarding formatting of do/while conditions

Do while behaves slightly different than while. You managed to find the exact difference :). Do while executes the code inside once and then checks your condition. That means in all cases the Do ...
Volvovics Adrian's user avatar

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