243 Answered Questions for the topic C
C
03/18/19
What is the behavior of integer division?
For example, int result; result = 125/100;or result = 43/100;Will result always be the floor of the division? What is the defined behavior?
03/18/19
What happens when you logical not a float?
I assume this just returns an int. Is there anything else going on I should be aware of? C/C++ differences?
float a = 2.5;
!a; // What does this return? Int? Float?
C
03/18/19
Is there a performance difference between i++ and ++i in C?
Is there a performance difference between `i++` and `++i` if the resulting value is not used?
What is Linux’s native GUI API?
I hope this doesn’t come across as a stupid question but it’s always something I have wondered. Both Windows (Win32 API) and OS X (Cocoa) have their own APIs to handle windows, events and other OS...
more
C
03/18/19
C pointer to array/array of pointers disambiguation?
What is the difference between the following declarations: int* arr1[8]; int (*arr2)[8]; int *(arr3[8]);What is the general rule for understanding more complex declarations?
C
03/18/19
Why do pthreads’ condition variable functions require a mutex?
I’m reading up on `pthread.h`; the condition variable related functions (like `pthread_cond_wait(3)`) require a mutex as an argument. Why? As far as I can tell, I’m going to be creating a mutex...
more
C
03/16/19
What is the difference between char s[] and char *s?
In C, one can use a string literal in a declaration like this: char s[] = "hello";or like this: char *s = "hello";So what is the difference? I want to know what actually happens in terms of...
more
C
03/16/19
How do I check if an integer is even or odd?
How can I check if a given number is even or odd in C?
C
03/16/19
Passing by reference in C?
If C does not support passing a variable by reference, why does this work? #include void f(int *j) { (*j)++; } int main() { int i = 20; int *p = &i; f(p); ...
more
C
03/16/19
How do you compare structs for equality in C?
How do you compare two instances of structs for equality in standard C?
C
03/15/19
How to escape the % (percent) sign in C's printf?
How do you escape the % sign when using `printf` in C? printf("hello\\%"); /* not like this */
C
03/15/19
Why does sizeof(x++) not increment x?
Here is the code compiled in dev c++ windows: #include int main() { int x = 5; printf("%d and ", sizeof(x++)); // note 1 printf("%d\ ", x); // note 2 return...
more
C
03/15/19
Is there a printf converter to print in binary format?
I can print with printf as a hex or octal number. Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf("%d %x %o\ ", 10, 10, 10); //prints "10 A 12\ " ...
more
C Swift
03/13/19
Is Swift easier to learn than Objective C?
10/08/18
tricky c++ if else question
Why will it print the bold statements? what about Hi-5 "
#include <iostream>using namespace std;int main (){ if ((4 < 2 ) && (3 == 3)) cout << "Hi-2 "; else if (3==3) cout...
more
10/08/18
if else confusing problem?
In this program no matter how many times i run it it wont print out the statement in bold.
shouldnt it print evert statement after else?
it will only print "HI-6"
#include...
more
if I'm getting 100% in the class, and get a 50% on my quiz, what does that average my grade to?
I have an A, and I got 21 out of 42 on a test. I'm scared I might fail, or get below a D or C, and I'm not really sure how to calculate it. Please help!
C
03/06/18
24.0mL of an unknown concentration of HCI are titrated with 1.8M KOH. How many moles of KOH are used if the volume titrated is 6.5mL?
Trying to figure out how to get a answer to this.
09/06/17
Char tic tac toe
char tic_tac_toe(char board[][3]): Given the configuration of atic-tac-toe board, return the winner (‘x’ if ‘x’ wins, ‘o’ if ‘o’ wins, and ‘d’ if it’s a draw ).
09/06/17
Size of array
void copy(int a[], int b[], int n): Make a copy of a givenarray a of size n into b. Assume that the size of array b is the same as a and the memory for array b has been allocated.
09/06/17
arrays question
int sorted(int a[], int n): Test if a given array a of size n is sortedin ascending order.
C
03/18/17
Can you tell me line by line what my code does?
I need this done! Can you help me please?
Void setup () {PinMode (5, INPUT);PinMode (10, OUTPUT);PinMode (13, OUTPUT);Serial.begin (9600);}VoidLoop (){Bool moistureDetected = digitalRead...
more
C
03/13/17
write a program to Sort a 20 data using Q Basic.
write a program to Sort a 20 data using Q Basic.
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.