Search Results

Showing results 1 to 40 of 79
Search took 0.06 seconds.
Search: Posts Made By: ArkM ; Forum: C and child forums
Forum: C Jun 12th, 2009
Replies: 6
Solved: Array question
Views: 380
Posted By ArkM
>...if you want to be a pedant...
To make distinctions between static, automatic and dynamic attributes - is it too pedantic for you?
;)
Forum: C Jun 12th, 2009
Replies: 8
Views: 877
Posted By ArkM
In C you can assign void* type pointer value to the pointer of any type without casting. So simply declare a proper type pointer and set it to the buffer:

char* pchar = buf_ptr;
char* ptr = pchar...
Forum: C Jun 12th, 2009
Replies: 6
Solved: Array question
Views: 380
Posted By ArkM
>short answer: static arrays are allocated when the function is called...
Short remark: static arrays are allocated before the first call of the function. However no static arrays in OP snippet....
Forum: C Jun 10th, 2009
Replies: 18
Views: 883
Posted By ArkM
>More random calls will tend to dilate the variance.
The variance of... what? We didn't estimate random sequence parameters in that case so the variance (or other moments) does not bear a relation...
Forum: C Jun 9th, 2009
Replies: 18
Views: 883
Posted By ArkM
A day ago csurfer's algorithm solved the problem. That's "pipelined" version:

int i, j = rand()%20;
for (i = 0; i < 20; i++)
array[i] = (i != j)*(rand()%9 + 1);

In addition:...
Forum: C Jun 9th, 2009
Replies: 14
Solved: File handling
Views: 876
Posted By ArkM
That's it:

(256 in C++)
Forum: C Jun 8th, 2009
Replies: 5
Views: 551
Posted By ArkM
Why strncat? Make a single (expected) string by a single snprintf call. What's a problem?
Forum: C Jun 7th, 2009
Replies: 14
Solved: File handling
Views: 876
Posted By ArkM
The second argument type is a pointer to a pointer to FILE type.
Didn't you understand what's a pointer?
Evidently this function returns FILE* pointer via this argument. What's a strange...
Forum: C Jun 7th, 2009
Replies: 1
Solved: absread
Views: 365
Posted By ArkM
absread:
What's it: ancient TC non-standard function to read a sector from the HD in native DOS environment.
Usage: forget as soon as possible.
Forum: C Jun 7th, 2009
Replies: 11
Views: 666
Posted By ArkM
Excuse me, siddhant3s: I have not seen your post above! :(
No need in my post now.
Forum: C Jun 7th, 2009
Replies: 11
Views: 666
Posted By ArkM
According to the C and C++ standards

int array[....];

array[-2] - wrong expression, because array-2 points to inexisting array element (the only exception: pointer to the 1st element after...
Forum: C Jun 3rd, 2009
Replies: 7
Views: 319
Posted By ArkM
More precisely: if the program attempts to modify an array corresponding to a string literal, the behavior is undefined.
Forum: C Jun 1st, 2009
Replies: 9
Views: 385
Posted By ArkM
Well, let f(i) is i-th member without sign (it's not C).

f(i) = i/i! = i/(1*2*...*(i-1)*i) =
i/(i*(1*2...*(i-1)) = 1/(i-1)!
f(i+1) = 1/i! = 1/((i-1)!*i) = f(i)/i
i = 1, 2,... (0! = 1 by...
Forum: C Jun 1st, 2009
Replies: 9
Views: 385
Posted By ArkM
See: you have fac > no for all no values because fac = n!. Therefore no/fac == 0 (integer division) and com=com+j is the same as com += 0...

1. Use double type for math calculations (not float)....
Forum: C May 26th, 2009
Replies: 7
Views: 607
Posted By ArkM
Of course, you have linker error because nobody (except you) knows such library function as concat (probably you want strcat).

The second attempt failed because fgets function puts the last '\n'...
Forum: C May 22nd, 2009
Replies: 5
Views: 446
Posted By ArkM
If you mean variable argument list, read this:
http://www.codeproject.com/KB/cpp/argfunctions.aspx?fid=15556&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=1066108
Forum: C May 16th, 2009
Replies: 5
Solved: Help
Views: 426
Posted By ArkM
Start from this forum announcement: http://www.daniweb.com/forums/thread78060.html
(especially Describe your problem clearly and fully! paragraph).
Forum: C May 15th, 2009
Replies: 7
Views: 308
Posted By ArkM
Sorry, I don't understand:
>why when i do buff[i]=0;...
No such assignment in the squeeze function!
WHY and WHERE you do buff[i]=0?!
Forum: C May 15th, 2009
Replies: 7
Views: 308
Posted By ArkM
>i began reading K&R ...
Well, let's read the next sentence after squeeze function definition:

What else?
Better turn off your computer, take a sheet of paper and a pencil then try to squeeze a...
Forum: C May 15th, 2009
Replies: 5
Views: 580
Posted By ArkM
if (x - y + abs(x-y)) { /* x > y */

;)
Forum: C May 5th, 2009
Replies: 12
Views: 1,736
Posted By ArkM
Well, and what do you want to do with this 5-years old slops?
Better think then implement the proper solution from the scratch.
Forum: C May 5th, 2009
Replies: 12
Views: 1,736
Posted By ArkM
Can you present the original specification of the "remove chars" stuff (not this wittingly incorrect implementation)?
Forum: C Apr 23rd, 2009
Replies: 2
Views: 326
Posted By ArkM
while("sMessage[x]"){

Why quotes?! ;)
It's a loop forever: while (pointer to string literal != 0). It never is null...
Forum: C Apr 23rd, 2009
Replies: 3
Views: 670
Posted By ArkM
Try DISLIN:
http://www.mps.mpg.de/dislin/
It's free for non-commercial use.
Forum: C Apr 10th, 2009
Replies: 2
Views: 313
Posted By ArkM
Better post a code where [i]macro doesn't seem to work[/icode].
More accurate this substitution definition is

#define stack_empty(x) (*(x) == 0)

However it's a strange parameter type stack**....
Forum: C Apr 10th, 2009
Replies: 6
Solved: equal lists
Views: 377
Posted By ArkM
Yet another defects (obvious):
1. The comparelist function does not compare lists, it compare two integers (now). Moreover, the 3rd parameter of equal semantically defines "compare nodes" function!...
Forum: C Apr 10th, 2009
Replies: 11
Views: 720
Posted By ArkM
1. Operator priorities: a<<2 + a treated as a << (2+a).
2. Undefined result; side effect of ++ operators and undefined order of argument list evaluation, cases [icode]<2>+=pow(2,2),...
Forum: C Mar 31st, 2009
Replies: 10
Solved: minmax
Views: 713
Posted By ArkM
Look at csurfer's post again!
It was the true solution of your problems (in other words, it was a correction of your mistake ;))...
Forum: C Mar 30th, 2009
Replies: 10
Solved: minmax
Views: 713
Posted By ArkM
Think about another approach:

struct IntRange { int minval, maxval; };

struct IntRange MinMax(const int* arr, int n)
{
struct IntRange range = { 0, 0 };
if (arr && 0 < n) {
...
Forum: C Mar 30th, 2009
Replies: 5
Views: 366
Posted By ArkM
It's wonderful but just before talking about this code run-time speed and other characteristics correct obvious errors in it. Now you can't compile this code: arr1 is not declared in the merge...
Forum: C Mar 29th, 2009
Replies: 7
Views: 578
Posted By ArkM
A name in C is a statically (before execution) defined program artifact, syntacticaly it's an identifier.

There are dynamically (in run-time) created and destroyed data objects and statically...
Forum: C Mar 27th, 2009
Replies: 5
Views: 674
Posted By ArkM
It seems it's your homework... See this forum rules... ;)
Some tips:
1. the scanner (lexical analyser) works "before" preprocessor so your 1st statement is wrong...
2. The C preprocessor is a...
Forum: C Feb 28th, 2009
Replies: 8
Views: 481
Posted By ArkM
Evidently it's impossible in terms of element access counter because no direct access to list elements so you need ~n/2 accesses to fetch a given number from a list - O(n) time complexity.

If n...
Forum: C Feb 25th, 2009
Replies: 2
Views: 339
Posted By ArkM
What is it - a file binarization?
Forum: C Feb 12th, 2009
Replies: 6
Views: 1,007
Posted By ArkM
What C compiler are you using? What's this pragma format description in the compiler manuals?
Forum: C Feb 6th, 2009
Replies: 4
Views: 409
Posted By ArkM
1. It DOES NOT work because you forgot to double backslashes in the file name string literal (see point #3 example in your snippet).
2. ? No platform-independent solution.
3. ShellExecute is a...
Forum: C Jan 1st, 2009
Replies: 11
Views: 1,061
Posted By ArkM
Well, and what's your problem now? Only inline and template function definitions are placed in .h files.
Look at http://www.daniweb.com/forums/thread165526.html. May be it helps...
Forum: C Jan 1st, 2009
Replies: 11
Views: 1,061
Posted By ArkM
I don't understand what's "formal function declaration". Have you ever seen informal function declarations?
Forum: C Jan 1st, 2009
Replies: 11
Views: 1,061
Posted By ArkM
That's the worst solution. Now you have a huge scrap heap of all possible interfaces. It's hard to maintain such a heap, you have drastically increased compilation time and full project recompilation...
Forum: C Dec 23rd, 2008
Replies: 7
Views: 843
Posted By ArkM
And don't forget to terminate the last token when break the loop...
Showing results 1 to 40 of 79

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC