Questions tagged [printf]

The tag has no usage guidance.

7 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
276 views

String being replaced by garbage before being printed

I have this code: #include <cs50.h> #include <stdio.h> #include <string.h> string increment_str(); int main() { string s = increment_str("xyz"); printf("String: %s\n", s); }...
0
votes
1answer
62 views

Vigenere Pset2 ciphertext question + others

(Main question- need help on this for code to work! highlighted in screenshot.) My PSET2 code works fine up until asking the user to input plaintext, but becomes funky and outputs blank spaces as the ...
0
votes
0answers
58 views

Printf prints newline character instead of string in Pset5

I'm working on the Speller program in Pset5. As always, i'm using a modular approach to construct all the required constituent functions one by one. However, something quite odd is happening in my ...
0
votes
0answers
60 views

2017 mario.c trailing whitespace for height < 23

I have been trying to fix the whitespace error generated with my code: int main() { int height; do { printf("Height: "); height = get_int(); } while (height < 0 || ...
0
votes
2answers
2k views

CS50 week 2 Caesar(cipher printf question)

#include <stdio.h> #include <stdlib.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main( int argc,string argv[]){ int k; if (argc == 2) { ...
0
votes
1answer
39 views

Printing text after GetInt()

I was wondering if there was a way to do something like the following Enter the coefficients in order __ * x^3 Where the __ is where the user will be prompted for input. However, I want the *x^3 ...
0
votes
1answer
76 views

segfaults and delayed printf commands while using GWindow in loop

printf("%c.\n", (getText(precrmo_menu[3]))[0]); char input[3]; input[0] = (getText(precrmo_menu[3]))[0]; printf("we lived"); if (strcmp(input, "") != 0 && !isblank(input) && ...