I'm working my way through a C++ book (again), and am up to a section on composition.
The book (Deitel) strongly recommends keeping such objects private: "[making member objects public] does...
Type: Posts; User: Matticus
I'm working my way through a C++ book (again), and am up to a section on composition.
The book (Deitel) strongly recommends keeping such objects private: "[making member objects public] does...
I like this approach a lot. Getting the range of acceptable values would then simply be a matter of grabbing a subsection of the pre-computed data.
I will probably use a Compute() method instead...
I'd recommend starting right at the source: Simple DirectMedia Layer - Homepage
There is a lot of information in their wiki to get started.
I'd also suggest you start getting used to separating...
I'm posting this here since I'm currently learning C#, but this is more of an OOP question.
The program I'm writing will calculate the parallel resistance of two resistors. The user enters a...
Hey all, it's been a long time.
How is everyone doing?
break is intended to break out of a loop or switch case. Did you mean to use while instead of if on line 7?
If your code still isn't working, you need to post the latest version. We don't know which bit of the [good] advice you chose to apply, and whether you've applied it correctly.
To make it easier...
You're reading and writing in binary, not text. In this context, '\0' does not behave as a string-terminating character. Hence it is printing the actual binary value of '\0'.
Incidentally, when...
Read post #2 again, and do a little bit of research.
Your code? What you've posted is extremely similar to the code here: c - Client connects to server randomly - Stack Overflow
Furthermore, you've provided no answers to the questions I asked. ...
If you're completely new to C, I would recommend starting with the basics, and tackling network and thread programming later on.
What type of sockets are you using?
Does your program use the...
Start with a simple practice program to test passing a struct pointer to a function and traversing the list. Something like this:
#include <stdio.h>
#include <stdlib.h>
struct stest
{
...
Yes, just keep track of the largest value while looping through the structs. If a larger magnitude is found, save this value (for subsequent comparisons) along with the corresponding value of N.
You asked this question on your other thread, let's keep it there -> keep getting an to me unknown error
It would be easier to help you if the prompts were translated to English. Also, you should provide the inputs that cause the problems you're seeing (what input are you giving it, what output do you...
If you want to access all allocated structs, have your function receive a pointer to struct. Then you can move through the structs as if it were an array.
A shorthand way of accessing an element...
You need to pass the address of the variable to scanf.
You may want to run your code through a debugger to find the problem. You are likely accessing memory you aren't allowed to.
You should not cast malloc, and you should check the return value of...
You need to declare the functions in the header file, like so:
#ifndef RATIONAL_H
#define RATIONAL_H
typedef struct {
long numerator, denumerator;
}rational;
There's an explanation and simple fix for that here: FAQ > How do I avoid a "dangling" newline when reading single character user input? - Cprogramming.com
There could be several reasons for this issue. Post a complete (preferably simplified) version of the program that exhibits the problem.
To compare strings in C, you should be using strcmp.
I second john.c's suggestion. You might consider reading up on the BMP file format and creating your own small library to manipulate the images however you'd like.
You're still trying to use the length of the string to determine whether to clear the input buffer, which will not work.
Check for the presence of the newline to determine if the entire input has...
That can be argued, yes, but in many cases you can avoid using goto by carefully planning and restructuring your logic to avoid heavily nested loops.
Yes, or any other input command.
Then that's the size you need to pass to fgets. As it stands, you're giving it sizeof(userInput) which is 64.