Forum: C 19 Hours Ago |
| Replies: 7 Views: 171 >restricted to use any of them, i should make my own one
That's stupid. You're not likely to invent a sorting algorithm that hasn't been invented before, and yours is much more likely to suck ass... |
Forum: C 1 Day Ago |
| Replies: 20 Views: 417 >I only posted because I agreed with the OP about our instructor.
>Then you proceed to call me a sock puppet...
Exactly. I call it like I see it, and if you have a problem with that, you're... |
Forum: C 2 Days Ago |
| Replies: 5 Views: 166 >Kindly let me know of alternatives of how I could solve this problem.
You're not actually appending to the file, you're appending to lines in the file, which amounts to inserting into the file.... |
Forum: C 3 Days Ago |
| Replies: 20 Views: 417 >I am not certain where to start.
Then you should consider switching your major. "I don't know where to start" is equivalent to "I'm not cut out for programming".
>1. Write a C program that only... |
Forum: C 4 Days Ago |
| Replies: 1 Views: 154 >It should be considered valid, but it's not.
Direct comparison of floating-point values is risky because some values might not be exact, and the comparison will produce an unexpected result. You... |
Forum: C 4 Days Ago |
| Replies: 3 Views: 167 >Here's all of it...
Wrong. First, you assumed too much about the question. Second, you assume that the structure you posted is universal. Third, you didn't explain squat about it. Someone who... |
Forum: C 4 Days Ago |
| Replies: 3 Views: 167 Good god, can't you come up with something a little more specific? |
Forum: C 5 Days Ago |
| Replies: 4 Views: 245 >Can someone explain me what does this mean?
>"40[^\"], %*c"
Assuming it's actually "%40[^\"], %*c", it means read a string of up to 40 characters or until a double quote is found (%40[^\"]), then... |
Forum: C 6 Days Ago |
| Replies: 2 Views: 219 >Now the question is how the Assember was implemented, i mean which language?
Any compiler can be written in a suitable existing language. The first assembler was probably hand compiled as machine... |
Forum: C 9 Days Ago |
| Replies: 4 Views: 270 >new_node->first->next = my_list->first;
my_list is a type, not an object. Perhaps you meant:
new_node->first->next = my_this->first; |
Forum: C 9 Days Ago |
| Replies: 4 Views: 270 Your code is C++, not C. In C++ void* conversions are not implicit and require a cast. |
Forum: C 9 Days Ago |
| Replies: 12 Views: 473 >lets say m=2, n=2 => calls m=1, n=1 => m=0,n=0 which returns num_elements =0
>control comes to fn m=1, n=1, num_elements get incremented and returned.
>control comes to m=2, n=2, num_elements get... |
Forum: C 9 Days Ago |
| Replies: 1 Views: 208 No code, no help. Read our rules. |
Forum: C 9 Days Ago |
| Replies: 1 Views: 215 Five days, huh? Maybe you aren't cut out for programming? Post your code and somebody will try to help you. |
Forum: C 9 Days Ago |
| Replies: 8 Views: 292 >but still compiled and ran without incident..
Yet another ding against gcc for not conforming to the standard, I suppose. Those switches put the compiler in strict conformance mode, which means a... |
Forum: C 9 Days Ago |
| Replies: 8 Views: 292 >I tried compiling this with the GCC compiler and its works...
Try again with the -ansi, -pedantic, and -Wall switches. |
Forum: C 9 Days Ago |
| Replies: 8 Views: 292 >whats the story.
The story is that the code you posted is not valid C. You're likely relying on a compiler extension that allows nested function definitions. What compiler are you using? |
Forum: C 9 Days Ago |
| Replies: 12 Views: 473 >i understand recursion, [but my] basic doubt is <blah blah>
That doubt is precisely why I don't believe you understand recursion. So why don't you explain how recursion works to me, using a common... |
Forum: C 9 Days Ago |
| Replies: 4 Views: 327 >but many books have this specifier.
I hate to break it to you, but many books are written by people who know little more about C than you do. The lesson about %lf is that printf is not a mirror... |
Forum: C 10 Days Ago |
| Replies: 12 Views: 473 If you don't understand recursion, trace through the execution and see exactly what happens:
#include <stdio.h>
int function ( int m, int n )
{
int num_elements = 0;
printf ( "Entering... |
Forum: C 10 Days Ago |
| Replies: 7 Views: 406 >If you expect your IDE to come fully featured then it won't be lightweight....
The very definition of IDE implies a text editor, a compiler, a debugger, and build tools. vim is a text editor, not... |
Forum: C 10 Days Ago |
| Replies: 1 Views: 209 Q: Do you know how to do it on paper?
(a) No: Go figure that out before trying to write code.
(b) Yes: Show us your code, and be more freaking specific about what problem you're having.
Since... |
Forum: C 10 Days Ago |
| Replies: 4 Views: 256 >it won't work the way i want it
So fix it. We're not the psychic friends network, here to solve all of you problems with a crystal ball and smile. You wrote the damn program (and it's very short!),... |
Forum: C 10 Days Ago |
| Replies: 4 Views: 327 >i read that the precision of float is 6 digits and double is 10.
No, the precision of float is FLT_DIG and double is DBL_DIG, where both of those macros are defined in <float.h>.
>but it is... |
Forum: C 11 Days Ago |
| Replies: 12 Views: 473 >num_elements is returned by each call recursively, will it be
>overwritten with the local variable , from the calling function ?
num_elements is returned, but never modified except to increment... |
Forum: C 11 Days Ago |
| Replies: 2 Views: 239 >Is there any suggestion for improvement
Yes, I can recommend improvements:
>scanf("%d",&n);
Always check your input functions for success. Especially with user input, and more especially with... |
Forum: C 11 Days Ago |
| Replies: 12 Views: 473 In your current code you declare num_elements both in the global scope, and locally within main. When multiple variables from different scopes have the same identifier, the one from the most local... |
Forum: C 12 Days Ago |
| Replies: 7 Views: 343 That makes more sense. In the future it would be nice to include those defines in the code, if only to make life easier for the people helping you.
Anyway, your algorithm is somewhat nonsensical.... |
Forum: C 12 Days Ago |
| Replies: 4 Views: 342 >The serial number of motherboard must be obtained.
>How to do it under Windows ?
WMI FAQ (http://technet.microsoft.com/en-us/library/ee692772.aspx). |
Forum: C 12 Days Ago |
| Replies: 7 Views: 343 >Actually it does compile.
TYPE is never defined, which causes a relatively large number of errors regardless of which compiler one uses. You also rely on non-portable behavior that breaks two of... |
Forum: C 12 Days Ago |
| Replies: 11 Views: 7,307 >The better method as per me is
You do realize that the same solution was suggested in this thread three years ago, yes? :icon_rolleyes: |
Forum: C 12 Days Ago |
| Replies: 3 Views: 260 inline: Similar to C++'s inline keyword. It gives you the option of telling the compiler that you want inline expansion rather than real function object code. Inline functions are a safer and easier... |
Forum: C 13 Days Ago |
| Replies: 4 Views: 257 >the compiler is actually giving an error though -- "invalid operands to binary *"
The compiler is actually right. Multiplication for pointers is nonsensical. Why don't you tell us what you're... |
Forum: C 13 Days Ago |
| Replies: 3 Views: 284 >And here int edadMedia(struct persona * nombres) { }
>i wanted to create a pointer to an array of structs
That close to what you said, and personally I think it's what you really meant. When you... |
Forum: C 13 Days Ago |
| Replies: 6 Views: 253 >Because the OP created the arrays without a size.
And without a type. Are we also to assume that he wants a variant type?
>You're the first one in this thread to be rude.
If you think that's... |
Forum: C 13 Days Ago |
| Replies: 6 Views: 253 >With two dynamic arrays, your structure needs pointers to the arrays.
You're the first one in this thread to mention dynamic arrays. Why over-engineer the problem and confuse the OP? |
Forum: C 13 Days Ago |
| Replies: 6 Views: 253 >array1[];
>array2[];
A type and a size are both required.
>length;
A type is required.
>name1.array1[4] = {3,0,7};
>name1.array2[4] = {0,15,0,-4};
Alas, arrays can't be assigned to like... |
Forum: C 13 Days Ago |
| Replies: 3 Views: 284 Use nombres the same way in edadMedia as you did in main (ie. as an array). However, I strongly recommend that you pass the size of the array as well so that you can avoid bogus indexes in edadMedia.... |
Forum: C 13 Days Ago |
| Replies: 3 Views: 290 If you know how to use arrays, and you know how to use FILE pointers, you know how to use arrays of FILE pointers. There's really nothing tricky about it except for the number of files you can have... |
Forum: C 28 Days Ago |
| Replies: 16 Views: 595 >I don't really see your point....
That much is obvious.
>Is your point that is not 100% the standard?
My point is that it could potentially be the cause of your problem because a compiler is... |