Search Results

Showing results 1 to 40 of 394
Search took 0.03 seconds.
Search: Posts Made By: ArkM ; Forum: C and child forums
Forum: C Jun 16th, 2009
Replies: 6
Views: 290
Posted By ArkM
The most natural place for structures without tags is typedef declaration (it's the only place I've used anonymous structs ;)):

typedef struct
{
...
} Record;
...
Record rec;
Record*...
Forum: C Jun 12th, 2009
Replies: 6
Solved: Array question
Views: 375
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: 826
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: 375
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 11th, 2009
Replies: 7
Views: 581
Posted By ArkM
The new-line character is defined in C, it's '\n'. The fgets standard library function retains a single new-line character from text mode streams only, but...
be careful:
Forum: C Jun 11th, 2009
Replies: 14
Solved: File handling
Views: 856
Posted By ArkM
>Well I had seen it being limited in some early versions of cc gcc and all.
It was not the C language limit, it's a limit of the compiler (implementation),
>...Or atleast the method...
Generate a...
Forum: C Jun 10th, 2009
Replies: 7
Views: 770
Posted By ArkM
A user-defined main() is not the first (and the only) function in the executable module. Have you ever heard about sturtup code? A console mode program has opened i/o streams - it's a job for startup...
Forum: C Jun 10th, 2009
Replies: 14
Solved: File handling
Views: 856
Posted By ArkM
>Isn't 16 *'s maximum in C ???
I have never seen maximal values of translation limits were defined in C docs.
Forum: C Jun 10th, 2009
Replies: 18
Views: 862
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: 862
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: 856
Posted By ArkM
That's it:

(256 in C++)
Forum: C Jun 8th, 2009
Replies: 5
Views: 531
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: 7
Views: 581
Posted By ArkM
All except '\r' and (may be) quotes ;)

Do you really want to study C i/o basics on DaniWeb forum?
Better search for a good C i/o tutorial. There are lots of good links...
Forum: C Jun 7th, 2009
Replies: 14
Solved: File handling
Views: 856
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: 321
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: 6
Views: 418
Posted By ArkM
Use fseek and ftell functions from <stdio.h>.
Forum: C Jun 7th, 2009
Replies: 11
Views: 657
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: 657
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 7th, 2009
Replies: 5
Views: 779
Posted By ArkM
Now read why fflush(stdin) is wrong:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351
and how to flush the input buffer in C:...
Forum: C Jun 7th, 2009
Replies: 4
Views: 350
Posted By ArkM
>So, if you want to really use pointers pass all the pointers from the main function into the corresponding function.
It's too restrictive and unrealistic requirement.

>Even the pointer which you...
Forum: C Jun 6th, 2009
Replies: 4
Views: 350
Posted By ArkM
>If i use float instead of double, i get the answer 25.628401 (which is wrong...
1. It's the same question as Why Cessna 182 can't be so fast as F-22?: float data type has precision ~6-7 decimal...
Forum: C Jun 4th, 2009
Replies: 11
Views: 654
Posted By ArkM
No opened stdin and stdout streams in Win GDI applications (null pointers). You can't use scanf and printf functions in the program.
See, for example:...
Forum: C Jun 3rd, 2009
Replies: 3
Views: 578
Posted By ArkM
Of course, it's possible (under your program "manual" contol). Open file in binary mode. Use fread and fwrite function. See fseek library function to set current write position and ftell to get it.
Forum: C Jun 3rd, 2009
Replies: 10
Views: 1,381
Posted By ArkM
It seems you don't verify your list interface.
For example:
1. What's a role of the 1st insert_start parameter? You overwrite its value in the 1st statement of the function body then create new...
Forum: C Jun 3rd, 2009
Replies: 7
Views: 311
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 2nd, 2009
Replies: 4
Views: 550
Posted By ArkM
Can you put more specific question? How to...
- print a file to the same console window in parallel
- print a file to a new (console) window
- open then print a file from your (console) program...
Forum: C Jun 2nd, 2009
Replies: 9
Views: 491
Posted By ArkM
Can you explain what is it: binary search tree sorted with quicksort method???
Forum: C Jun 1st, 2009
Replies: 9
Views: 373
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: 373
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 Jun 1st, 2009
Replies: 10
Views: 571
Posted By ArkM
>c is generally slow compared to other programming language.
>Just out of curiosity, what languages should be faster?
Assembler, fortran?
Look at these wonderful benchmarks:...
Forum: C May 31st, 2009
Replies: 3
Views: 314
Posted By ArkM
Ooh, yet another grade supersystem...

Better try to search DaniWeb for grade. There are lots of dozens of grade calculation threads (solved;))...
Forum: C May 30th, 2009
Replies: 10
Views: 571
Posted By ArkM
Good programmers are capable to write more effective programs practically in any programming languages than bad programmers can do it in machine codes ;)
Forum: C May 28th, 2009
Replies: 5
Views: 455
Posted By ArkM
Better try to check it with your compiler.
Create test scenario(s): what to do - desired results. Write test driver, compile then run it. Compare results - and so on...
Forum: C May 27th, 2009
Replies: 6
Views: 845
Posted By ArkM
From the C Standard:

None the less look at the link mentioned above.
Forum: C May 27th, 2009
Replies: 6
Views: 845
Posted By ArkM
1. calloc, malloc, realloc et al: http://irc.essex.ac.uk/www.iota-six.co.uk/c/f7_dynamic_memory_allocation.asp (or lots of another tutorials on this topic).

2. (type)expression called cast. It...
Forum: C May 26th, 2009
Replies: 5
Views: 455
Posted By ArkM
>still i am not able to understand how we can store the next node address in the current node.
Please, read my previous post again. And again. And again...
Nobody can store the next node address in...
Forum: C May 26th, 2009
Replies: 5
Views: 455
Posted By ArkM
1. You may get 26-th character of readLine as readLine[26] - why sscanf(readLine+26...)?
2. Check input line length: may be no 26-th character in the line...
3. Why 'b' in +26 position corresponds...
Forum: C May 26th, 2009
Replies: 7
Views: 579
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 26th, 2009
Replies: 6
Views: 412
Posted By ArkM
>Or do you know the 'ultimate' way?
Why not?

char* condense(char* s)
{
if (s) {
char* p = s;
char* q = s;
/* (never write so:) */
do if (*p != ' ')
Forum: C May 26th, 2009
Replies: 11
Views: 559
Posted By ArkM
OK, Miracle or not Miracle - it's the other story...
You didn't answered the key question: what's is your problem?

Didn't you familiar with school-level arithmetics (where is conversion formula)?...
Showing results 1 to 40 of 394

 


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

©2003 - 2009 DaniWeb® LLC