Find an Online Tutor Now

192 Answered Questions for the topic C

C C++

3d

write a program to

Write a program to implement phone book dictionary using Binary Search Tree which provides following operations: (a) add new entry in phone book, (b) remove entry from phone book, (c) search phone... more
C C++

3d

write a program to

Write a program to construct binary tree from a given preorder and postorder traversal sequence.
C C++

3d

write aprogram to

Write a program to implement Binary search operation on any given set of integers.
C C++

3d

write a program to

a) Write a program to implement Quick sort for sorting a given set of integers in ascending order.b) Write a program to implement Heap sort algorithm for sorting a given set of integers in... more

(C++) How to make variable vertically?

So I know how to make text vertically but the thing is I don't know about the variable here's the... more

C++ problem on output

anyone knows to show exactly numbers like this: -550.987654321234 I'm using float or double it shows -550.988 and that's not the output I want. Anyone knows to solve this?
C

06/25/20

What is the output for f(-1, 4)?

void f (int x, int y) { while (x < y) { printf("%d ", y - x); x = x + 1; y = y - 1; }}

09/08/19

What could cause the compiler to return the error " undefined reference to `Print' " ?

I've been working on this simple C project, trying to implement header, implementation, and makefiles. My professor provided the code for us to test, however whenever I use the "make hello3"... more

07/12/19

I would like to be able to compare values in one CSV with a nominal set of values in another?

I have been given the task of injecting faults into a system and finding deviations from a norm. These deviations will serve as the failures of the system. So far we've had to detect these faults... more

07/11/19

Casio Calculator Programming?

I am planning to buy a CASIO FX-9860GII for school, but I am really interested in programming for it. I looked everywhere on the internet but could not find anything. Is it possible to create... more

06/27/19

Determine the sign of a 32 bit int?

Using ONLY: ! ~ & ^ | + << >> NO LOOPS I need to determine the sign of a 32 bit integer and I need to return 1 if positive, 0 if 0 and -1 if negative. Any ideas? I first... more
C

06/27/19

#define macro for debug printing in C?

Trying to create a macro which can be used for print debug messages when DEBUG is defined, like the following pseudo code: #define DEBUG 1 #define debug_print(args ...) if (DEBUG)... more

06/26/19

How dangerous is it to compare floating point values?

I know `UIKit` uses `CGFloat` because of the resolution independent coordinate system.But every time I want to check if for example `frame.origin.x` is `0` it makes me feel sick: if... more
C

06/26/19

Valid, but worthless syntax in switch-case?

Through a little typo, I accidentally found this construct: int main(void) {  char foo = 'c';  switch(foo)  {   printf("Cant Touch This\ "); // This line is Unreachable ... more
C

06/26/19

Simulink: How to get a buffer size that can be changed in C code?

I'm using a buffer from DSP System Toolbox in my Simulink model and genereate C code with Embedded Coder. I would like to have some kind of a parameter or define for the buffer size in my generated... more

06/26/19

Digit-increasing number test?

A number is called digit-increasing if it is equal n + nn + nnn + ... for some digit n between 1 and 9. For example 24 is digit-increasing because it equals 2 + 22 (here n = 2). Actually, a friend... more
C

06/26/19

Rounding Number to 2 Decimal Places in C?

How can I round a float (such as 37.777779) to two decimal places (37.78) in C?
C

06/25/19

Why aren't programs written in Assembly more often?

It seems to be a mainstream opinion that assembly programming takes longer and is more difficult to program in than a higher level language such as C. Therefore it seems to be recommend or assumed... more
C

06/23/19

Check that triangle is right?

I'm trying to check if a triangle is a right triangle in C language. `a`, `b` and `c` are lengths of sides of some triangle. int is_right_triangle(int a, int b, int c) { return (a * a + b... more
C

06/23/19

Undefined reference to pthread_create in Linux?

I picked up the following demo off the web from https://computing.llnl.gov/tutorials/pthreads/ #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 void... more
C

06/23/19

What is ultimately a time_t typedef to?

I searched in linux box and saw it being typedef to typedef __time_t time_t;But could not find the __time\\_t definition.
C

06/22/19

How can one print a size_t variable portably using the printf family?

I have a variable of type `size_t`, and I want to print it using `printf()`. What format specifier do I use to print it portably? In 32-bit machine, `%u` seems right. I compiled with `g++ -g -W... more
C

06/22/19

Why does the smallest int, −2147483648, have type 'long'?

For a school project, I've to code the C function printf. Things are going pretty well, but there is one question I can't find a good answer to, so here I am. printf("PRINTF(d) \ : %d\ ",... more

06/21/19

Can we implement a doubly-linked list using a single pointer?

I want to use a structure like: struct node { char[10] tag; struct node *next; }; I want to use the above structure to create a doubly-linked list. Is that possible and if yes, then how I can... more
C

06/21/19

Why do we need C Unions?

When should unions be used? Why do we need them?
1 3 4 5 6 7 8

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.