Search found 56 matches

by Fancy
Tue Jul 15, 2014 4:30 pm UTC
Forum: Fit Club
Topic: Fitness for the fitness impaired
Replies: 17
Views: 12649

Re: Fitness for the fitness impaired

Losing extra skin is a matter of time and your skin's elasticity. I've heard that rubbing coconut oil on the areas may help, but take this with a grain of salt. Feeling better... There are two factors, diet, cardio and strength training. Ideally, you'd go the low carb route but count calories (body...
by Fancy
Tue Jul 15, 2014 1:52 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9979
Views: 1977601

Re: Coding: Fleeting Thoughts

I do pretty strongly think that *(x + y) notation instead of x[y] is rarely appropriate. What he said. We're not trying to make you feel bad, we just want you to develop good coding habits now, while you're still fresh to the art of computer programming, both for your own sake, and for the sake of ...
by Fancy
Tue Jul 15, 2014 4:07 am UTC
Forum: Fit Club
Topic: Fitness for the fitness impaired
Replies: 17
Views: 12649

Fitness for the fitness impaired

This isn't exactly my field of expertise, but I'll try and word my post in a reasonable way. I want to lose some weight, lose some belly fat, and maintain (or minimize loss of) what little muscle I have got. Common goal, right? Now here's the kicker: Right now it's summer, but otherwise I am in scho...
by Fancy
Tue Jul 15, 2014 2:31 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9979
Views: 1977601

Re: Coding: Fleeting Thoughts

@Thresh, while iterators may look evil, they end up producing really elegant code. @Fancy Sure. But you are not supposed to be able to solve every end of chapter problem often, at least not easily. But some of them are just so easy even a 2 year old could do them, and I can't. "Write a functio...
by Fancy
Tue Jul 15, 2014 12:34 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9979
Views: 1977601

Re: Coding: Fleeting Thoughts

Write code better than your project deserves, so you become ready for a better project. :) You saying this makes me feel bad, but if I change now all of code will have to be changed for consistency. A fleeting thought addendum Trying to learn C is really frustrating me and making me feel like an ab...
by Fancy
Mon Jul 14, 2014 11:49 pm UTC
Forum: Coding
Topic: Project Euler
Replies: 411
Views: 157173

Re: Project Euler

You forgot to initialise sum? That code should be fine if you add sum = 0 at the start... Variables in C don't have default values; the value of an int when declared is undefined - it might be anything! Also, the line "else if ( num % 15 == 0 ) ..." is redundant; it's already ...
by Fancy
Mon Jul 14, 2014 11:13 pm UTC
Forum: Coding
Topic: Project Euler
Replies: 411
Views: 157173

Re: Project Euler

One possible hiccup: it does say "less than 1000"... and it means it, it's not "less than or equal to 1000". Other than that... show us your code? (If you really have lost it, it would probably be faster to just write it again than to go looking for it...) Ugh. I'm getting 232, ...
by Fancy
Mon Jul 14, 2014 4:05 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 556779

Re: The "IT DOESN'T WORK!" thread

Xenomortis wrote:If it's working, great.
But do you understand why the code I was looking at was failing?


Because

Code: Select all

**ch     points to an array of arrays (posssibly an array of strings
*ch points to just the single array, or in my case a string
by Fancy
Mon Jul 14, 2014 3:39 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 556779

Re: The "IT DOESN'T WORK!" thread

Xenomortis wrote:If it's working, great.
But do you understand why the code I was looking at was failing?


Because

Code: Select all

 **ch     points to an array of arrays (posssibly an array of strings
*ch points to just the single array, or int my case string
by Fancy
Mon Jul 14, 2014 3:27 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 556779

Re: The "IT DOESN'T WORK!" thread

It does compile, and I have down to no warnings or anything, but it just prints the entire original string regardless. Are you absolutely sure that this: #include <stdio.h> void find_nth(char *str, int n); int main(void) { int n; char str[101]; char *ptr = str; puts("Enter ...
by Fancy
Mon Jul 14, 2014 3:03 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9979
Views: 1977601

Re: Coding: Fleeting Thoughts

Meh. I assumed people would disagree, but at the moment I'm just casually writing my own code. If I was writing code for an open-source project or actually employed, I like ot think I would take the time to do something other people find reasonable. How do they dffer in C++? I don't really plan on ...
by Fancy
Mon Jul 14, 2014 2:40 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 556779

Re: The "IT DOESN'T WORK!" thread

Does that even compile? find_nth takes parameters of type char* and int, but you're passing it char** and int. If that does compile, then find_nth is not going to end up doing what you expect, since the pointer you've received isn't meaningful in that context. What exactly is main doing with pointe...
by Fancy
Mon Jul 14, 2014 2:00 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 556779

Re: The "IT DOESN'T WORK!" thread

Fancy, Your code has several pointer-related problems. I'll give you a few hints that will hopefully help you to repair it. • Your main() function does weird things with ptr, but I guess that's a side-effect of your find_nth() taking a pointer to a pointer. If you need more hints, please ask. I cha...
by Fancy
Mon Jul 14, 2014 1:38 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9979
Views: 1977601

Re: Coding: Fleeting Thoughts

...A continuation of my last fleeting thought. The two argc was an accident, sorry for any confusion. I prefer it for the aesthetics, ut many people mention that it is harder for beginners to understand...I seem to be doing just fine though. first, it is usual to call the int argc, but the other arg...
by Fancy
Mon Jul 14, 2014 5:41 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9979
Views: 1977601

Re: Coding: Fleeting Thoughts

I'm really fighting with myself over which notation to use in the following situation. Anyone have input on it? I personally prefer the second, less-common form. int main(int argc, int *argc[]) /*the more common of the two...or*/ int main(int argc, int **argc) /*the one I prefer*/ From what I unders...
by Fancy
Sun Jul 13, 2014 7:28 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 556779

Re: The "IT DOESN'T WORK!" thread

I'm working on learning C and the book has a problem "Design a function tooutput up to the nth character." I've got the following code, but it just isn't working. First I had it returning nothing, now it returns the original string. Could someone pelase point out my error to me? #include <...

Go to advanced search