Skip to main content

All Questions

Tagged with
0 votes
4 answers
135 views

The issue of %5c causing output exceptions in C language

#include <stdio.h> int main() { int y = 0, w = 0; scanf("%d %5c", &y, &w); printf("%d,%c\n", y, w); return 0; } When i input 2000 12345, the output ...
kangaroo's user avatar
0 votes
0 answers
32 views

Why can't I get an output on the printf statement in C language right after the scan statement, the run command skips it completely [duplicate]

I am new to C language coding, I was trying to learn the various inputs that I can take from the user and display the same but I keep getting a blank in the place of the printf statement that takes ...
Saikat Das's user avatar
0 votes
1 answer
89 views

I cannot get the scanf function to work while using VScode

I made a simple program for a class using c and printf would work just fine; however, when I added the Scanf function, nothing would work not even the printf lines. My teacher used the same code on VS ...
Cody T's user avatar
  • 11
0 votes
1 answer
116 views

are printf and scanf used safely here in this code?

#include <stdio.h> int main() { char a[12]; int b = scanf("%11s", a); if (b != 1) { return 1; }; if (printf("%s", a) > 11) { return 1; ...
unknown's user avatar
2 votes
1 answer
67 views

using scanf to read strings in nasm

im working on a script which will read a string from the user and print it back, i wanted the script to read the input using scanf and print it back with printf. So far i tried following those forums: ...
Hrodebert's user avatar
2 votes
2 answers
193 views

How to print a statement which includes a scanned character and an integer in C?

This is the code that I am trying to run - #include <stdio.h> int main() { char a; int b; printf("Name of Prisoner\n"); scanf("%c" ,a); printf("How many years in jail ...
Apan Sirohi's user avatar
1 vote
1 answer
106 views

Don't know what's wrong with the scanf function [duplicate]

I'm trying to get 2 integers from the user input by scanf function and use printf to print out that input. Somehow, I can't print out the 2nd integer. What have I missed here? #include <stdio.h> ...
nmn's user avatar
  • 23
-2 votes
1 answer
112 views

functioning mechanism of scanf() and printf() inside the programme in C [duplicate]

I have used to write c programming using the scanf() and printf() and faced some issues while i changed the writting format inside them and tried to understand the reason of the output for the ...
Gyanaranjan Behera's user avatar
1 vote
0 answers
66 views

git bash first runs the scanf() before the first printf() function

I am doing a simple C program that accepts input and display some number. #include<stdio.h> int main() { int num1, num2, value; char sign; printf("Please Enter Your Number1:\n&...
Mehedi Hasan's user avatar
0 votes
1 answer
61 views

c nested scanf in printf along with another variable

I wrote the following c codes code1 #include <stdio.h> int main() { int z = 9; printf("%d\n", printf("%d%d", scanf("%d", &z), z)); return 0; } ...
user avatar
0 votes
0 answers
58 views

scanf() making program not run correctly in C

When I run my program using scanf() none of my prior print statements print (scanf() statement is at end of program after a printf() statement), it is only when I input something that my program will ...
Gavin Robinson's user avatar
1 vote
0 answers
83 views

printf skipped after scanf statement [C]

I'm struggling to understand how buffers work in c. I'm trying to create a terminal program that involves the following do-while loop do { system("clear"); /...
Luke__'s user avatar
  • 255
-2 votes
2 answers
91 views

How to print two strings on the same line in c using printf

I am trying to print the out put of name and phone. Keeps showing this two errors in terminal format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ and format ‘%s’ expects ...
wanicedude's user avatar
0 votes
3 answers
97 views

How to stop C storing values that creep into operation?

I write a simple program which multiplies two numbers. When I multiply it by getting scanf input, it prints out random answers... #include<stdio.h> int main() { int a, b ,c = a * b; ...
Taranveer Singh's user avatar
0 votes
0 answers
32 views

why does scanf works only one time? [duplicate]

I don't understand why the code is not working - if I run each part alone it works fine, but together it does not. Here is my code: #include <stdio.h> int main() { ///////part 1////////// ...
Austin Drake's user avatar

15 30 50 per page
1
2 3 4 5
40