You're error (warning) seems to appear on a line (94) that you haven't posted.
Type: Posts; User: MacNilly
You're error (warning) seems to appear on a line (94) that you haven't posted.
You can't now. Moderators will fix it, maybe...
Forum rule: Don't create a new thread for the same problem. For everyone's sake.
Maybe if this was Javascript, you'd get a "0" instead of a SEGFAULT.
Or consider why
for (j = 0; j < 1; j++)//print base first
is a "loop" that loops only once?
Another option is to make "choice" an "int" variable, and simply use another "scanf(%d, &choice)". IIRC, the %d specifier is defined to skip any leading whitespace in the input buffer. However, for...
Remember, everything you write into the a buffered input stream, remains in the buffer, until it is read back out.*
* This is a non-technical discussion, but at least holds for this case.
I'm gonna take a gamble..
The
scanf("%d", &n);
read an integer from the input buffer (standard input, STDIN), but left the '\n' (newline, return) character that you entered, is still in...
I recommend Cairo, I have used both the native C library and the Python interface. Very good, IMO. +1 for Cairo!
I actually once got quite into it, and ended up writing a (very simple) graphing...
Do you mean to draw a triangle? A pyramid is a 3D structure, and cannot faithfully be rendered using this technique.
You want to render something like this?
#
#.#...
"But they do have the same IP address."
Woah!
Anyways... Maybe I meant "non-standard" instead of "vendor-specific". Although, I bet different vendors DID provide different prototypes within...
Yes, unless I snarf properties of the implementation language (Java currently), I have come to the conclusion that, in order to port to C, I will have to at least implement my own GC. I've been...
#include <conio.h>
That's a vendor-specific (and outdated) header file. It doesn't exist in modern standard C, nor does any modern C compiler (that I know of) support it.
In general, that's a...
Thanks for the replies. I really only care because I'd like to port a Java project into C++, and I'm concerned about how to manage memory usage. The project is a simple interpreter for a functional...
No worries, I know (knew) some "professional" (paid) programmers who stated that they really don't "get" pointers, or at least C pointers. Every language has "pointers" whether they are hidden behind...
There's some math explanation here if you like it. I'd say reducing you're loop from O(N) to O(log_2 N) is quite an improvement!
algorithm - Why do we check up to the square root of a prime number...
One optimization I've seen is to only check divisors up to the sqrt of the number being checked for primality.
Because, say 2 objects A and B, A contains a reference to B, and B contains a reference to A, their reference count is 1 for each of A and B, always. Even if no other object C has a reference to it....
The real heart of the halting "problem" is for people trying to prove that some algorithm they invented always terminates for all inputs. Like those graph and sorting algorithms you've heard of.....
One last idea: the hardware stack is "automagically" GC'd, and C++ "smart pointers" take advantage of this using their destructors and reference counting to release resources when the _pointers_ are...
A similar train of thought:
"The idea behind C++ was that you would not pay any performance impact for features that you don't use. So adding garbage collection would have meant having some...
I've heard rumors of a GC'd C++. Is it possible, and what are the implications? Wouldn't it just have to end up being an (compiled) interpreter that gets embedded into the executable at runtime?
I...
For some reason I can't post the link. Just google "The C programming Language by Brian W. Kernighan and Dennis M. Ritchie." It's a free PDF and covers everything C, including functions.
BTW, C...
#include "windows.h"
#include "iostream"
#include "support.h"
That's just wrong.
[EDIT]
Actually that code is just wrong. Horrid.
The correct answer is ... "I have no idea, unless you provide a context".
[EDIT]
Oh, how gross...
Ok, nevermind about that detail. It was too detailed.
Whats the confusion here? You understand that the function
int contar_caracter(char *string, char ch)