Exit from while loop without break in C

I have the following code: void takeOrder(void) { int stop = 0; while(stop != 1) { printf("What is your order?\n"); printf("%c - fruitShake\n%c - milkShake\n", FRUIT_SHAKE_CHOICE, MILK_SHAKE_CHOICE); scanf("%c", &typeChoice); i...
more »

2017-12-01 16:12 (4) Answers

``continue`` breaks label placement

This works just fine: #include <stdio.h> int main(){ volatile int abort_counter = 0; volatile int i = 0; while (i < 100000000) { __asm__ ("xbegin ABORT"); i++; __asm__ ("xend"); __asm__ ("ABORT:"...
more »

2017-11-07 10:11 (2) Answers

PHP - While and wrap div

I need wrap date and all events in one day to div "obal_date" but this not work. The number of events may be different, but I need wrap date + all events. Please how can I do that. Thank you very much. <?php # This will hold what group we're in...
more »

2017-11-01 08:11 (1) Answers

udp socket programming file transfer

Server Side Code......... #include<stdio.h> #include<string.h> #include<stdlib.h> #include<arpa/inet.h> #include<sys/socket.h> #define BUFLEN 503 #define PORT 8885 void die(char *s) { perror(s); exit(1); } in...
more »

2017-10-31 10:10 (2) Answers

Xcode- C programming - While loop

I have an error/warning associated with "while" loop, in Xcode. Any suggestions on how to fix it? while ( (c=getchar() != '\n') && c != EOF); While loop has empty body Picture in the IDE: ...
more »

2017-09-29 22:09 (1) Answers

Yes no string in C

I've searched the forums, and I can't seem to find an answer that is suitable for my specific problem (I tried Google as well). I seem to be having an issue comparing the strings ("Yes", "yes", "No", "no") correctly. I tried an if else originally, ...
more »

2017-09-10 23:09 (2) Answers

DispatchQueue not working in while loop

Edit: I once I restarted the computer and tried the simulator agian terminal displayed the message, Terminal has detected that the system is running low on swap space. Scrollback buffers may automatically be timmed to conserve swap space. I am not ...
more »

2017-09-10 21:09 (0) Answers

SQL Server while loop and dynamic SQL

I am trying to execute the dynamic SQL from SQL Server while loop. When the only print statement is executed query prints in the correct format but does not execute dynamic SQL with execute() or SP_EXECUTESQL. Please suggest. Code: WHILE( @count >...
more »

2017-09-04 08:09 (2) Answers

While loop won't work

I am making a program where you enter in the student's grade, and it counts who passes and fails, then Z is supposed to mean the program should end. But whenever I type in "Z", it just prints out: <Z is NOT an acceptable grade.> So something...
more »

2017-07-31 21:07 (1) Answers

K&R - Exercise 1-9 - Removing Spaces

I recently started learning C using the K&R book (2nd ed.) and I'm just having trouble wrapping my mind around this solution to exercise 1-9 which is: Write a program to copy its input to its output, replacing each string of one or more bl...
more »

2017-07-16 17:07 (2) Answers

Why is Ruby's loop command slower than while true?

Ruby has a built-in loop command that executes the block following it forever (or until stopped by break). However, when comparing it against the functionally similar while true, it is significantly slower: require "benchmark/ips" NUMBER = 100_000_...
more »

2017-07-13 02:07 (2) Answers

While statement skips fist row

I think that because of the if statement, the while statment skips the first one. But i need the IF and i need the WHILE. here is my code: if($row_antwoorden_select = mysqli_fetch_array($results_antwoorden_select)){ while($...
more »

2017-06-10 22:06 (2) Answers

My while loop won't stop with a break?

if (sum < 6) { System.out.println("You win"); System.out.println(); // Does the user want to retry? System.out.print("Would you like to retry?(Y or N) : "); String retry = input.nextLine(); while (true) { // If the...
more »

2017-05-14 23:05 (1) Answers