Linked Questions

0 votes
1 answer
4k views

Code is as follows: #include <stdio.h> #include <signal.h> #include <stdlib.h> #define SIZE 1024 char buffer[SIZE] = {0}; void timeout(int sig); int main(void) { signal(...
ZhangXiongpang's user avatar
0 votes
1 answer
726 views

i have a function that ask to the user to enter a value to calculate its square root, however when i try to validate that the number of the input must be a number and not a char, it makes an infinite ...
Kleiver Marcano's user avatar
123 votes
20 answers
543k views

I have the following program: int main(int argc, char *argv[]) { char ch1, ch2; printf("Input the first character:"); // Line 1 scanf("%c", &ch1); printf("...
ipkiss's user avatar
  • 13.7k
5 votes
8 answers
8k views

I am not able to flush stdin here, is there a way to flush it? If not then how to make getchar() to take a character as input from user, instead of a "\n" left by scanf() in the input buffer?? #...
deovrat singh's user avatar
6 votes
4 answers
16k views

Whenever I do a scanf before a fgets the fgets instruction gets skipped. I have come accross this issue in C++ and I remember I had to had some instrcution that would clear the stdin buffer or ...
nunos's user avatar
  • 21.6k
2 votes
3 answers
8k views

#include<stdio.h> #include<conio.h> main() { int i; char c, text[30]; float f; printf("\nEnter Integer : "); scanf("%d",&i); printf("\nEnter ...
Ravitheja's user avatar
  • 142
2 votes
5 answers
4k views

In this code, scanf works only once. What am I doing wrong? #include <stdio.h> #include <unistd.h> int main() { int i = 1; if (! fork()) { while(i) { ...
user277773's user avatar
-3 votes
2 answers
9k views

I´m completely new to programming and just started some tutorials from the internet. One of them suggested this code for an easy question for the user: #include <stdio.h> #include <stdlib.h&...
themoleofdoom's user avatar
0 votes
3 answers
3k views

Does anyone know why the printf("Type q to quit") line prints twice in the terminal when I run this code: #include <stdio.h> #include <unistd.h> int main (int argc, char *argv[])...
Mike's user avatar
  • 825
2 votes
3 answers
2k views

A friend of mine is trying to learn c (on her own, with a book) and sometimes she asks for help. She just showed me something I can't answer; I'm ashamed but I studied C in college and then moved to ...
0plus1's user avatar
  • 4,563
2 votes
1 answer
1k views

When i try to compile my code i get the following errors: error #2168: Operands of '=' have incompatible types 'char [255]' and 'char *'. error #2088: Lvalue required. i get these errors for the same ...
zellwwf's user avatar
  • 83
0 votes
3 answers
2k views

I am programming in C. For some reason is just skips over my fgets and runs the code afterwards and I don't know why. char content[256]; printf("What do you want it to say?\n"); fgets(content, 256, ...
Tanner Ellis's user avatar
2 votes
4 answers
2k views

I'm just a beginner and am trying to make a a program that asks for a number and if a letter is input, it says "that's not a number" and asks for a number again, until a number is input. However, my ...
grammer's user avatar
  • 245
1 vote
4 answers
1k views

I have the following code: #include <stdio.h> int opt; scanf("%d",&opt); while(opt!=0) { switch(opt) { case 1:func1(); break; case 2:func2(); break; case ...
Danis Fischer's user avatar

15 30 50 per page