nezachem 616 Practically a Posting Shark

-L tells the linker where to look for libraries. It still needs to know which libraries to link in. That's what -l option is for.
add -llapack -lblas

nezachem 616 Practically a Posting Shark

Through my crystal ball I see that you need to add -llapack -lblas to your linker command line.

nezachem 616 Practically a Posting Shark

This particular problem has an iterative solution as well. Set up an array of N ints, and treat it as a max-base number. The increment function gives you a next combination:

bool increment(int arr[], int N, int max)
{
    int i;
    for(i = 0; (i < N) && ((arr[i] += 1) == max); i++) {
        arr[i] = 0;
    }
    return i < N;
}
nezachem 616 Practically a Posting Shark

OS/360 clone, Fortran IV, punchcards
PDP-11 clone, asm, punch-tapes
CP/M, Forth, 8" floppies
etc

nezachem 616 Practically a Posting Shark

> What is 'filo'?

Probably Filo.

nezachem 616 Practically a Posting Shark

The line

fp=fopen("random.txt","r");

makes me believe that the file contains textual representation of data. It must be converted to doubles via a proper format specifier of scanf, or via strtod, etc.
fread doesn't do any conversion. It just reads bytes.

nezachem 616 Practically a Posting Shark

Tried that. No luck.

Are you running Python 3.x? The code is written for Python 2.6; you need to either downgrade Python, or convert the code with 2to3 tool (a part of Python distribution).

nezachem 616 Practically a Posting Shark

I think we all attempted to understand the question. I don't think this is the type of question that any of us are used to hearing around here.

I suppose I was overly harsh. I expected that problems of this kind are too well known. My apologies.

Whether that's a good skill to have is probably debatable.

Agree 99%. The remaning 1% of disagreement is that this skill is undebatably bad.
A K&R1 language definition was obsoleted just to avoid such abuses.

nezachem 616 Practically a Posting Shark

Wrong. When asked for clarification, he regurgitated the requirements originally posted. Since I quoted them, I already knew them, and stated I did not understand them. To repost them was a complete waste of time and utterly worthless. They are now posted in the thread at least 4 times. By your disagreement you are stating "the more times you post the same information the clearer the information becomes. Good luck with that.

Let's go through the logics, because you definitely lost me.
There was a statement: Information was asked for, and it was not provided
to which I disagreed by saying: Information was provided.
Can you clarify how does it come to the more times you post the same information the clearer the information becomes.?

nezachem 616 Practically a Posting Shark

> Information was asked for, and it was not provided

May I respectfully disagree. If you ever participated in those stupid contests, you'd immediately realize what the OP is asking for. That said, OP doesn't seem to do it either.

Now I am going to play an advocate. All the information is here in the thread.
For example, Twice x="%d" has been mentioned was answered even before the question was asked: Warnings are not to be considered. That is, a code should comply to K&R spec, so x shall be treated as an extern int, and a warning of char*-to-int cast is irrelevant.
Same goes for reuse of char** arguments of main as ints.

The question asked was not "how can I make it compliant", and not even "what's wrong with it", but "how to reduce it". Nobody even attempted to understand the question, except Adak.

nezachem 616 Practically a Posting Shark

Sorry people, it is more than I can bear. We all agree that
1. The assignment is stupid
2. The code is ugly
3. OP doesn't have a clue
yet none of the above gives a reason to teach things you've not be asked for.

If you have nothing to say on the subject, it is perfectly OK to remain silent.

WaltP commented: Yes I CAN as 6 and 5 -- but I have to understand the problem to do that. -3
nezachem 616 Practically a Posting Shark

Then the question nails down to what exactly is the virtual spec of that virtual card.

All cards are really different. They all support the lowest common hardware denominator (that is is VGA), and their drivers support the lowest common sofrware denominator (that is, DX/OGL standard). Programming registers of GeForce has absolutely nothing in common with programming registers of Radeon, or Larrabee, or Integrated Graphics, or whatever else.

So, how does your card operate?

nezachem 616 Practically a Posting Shark

I do not. Making a good compiler is very difficult indeed, but I can name few tasks much more difficult.

WaltP commented: Like answering question with the details give in many of these threads. +16
nezachem 616 Practically a Posting Shark

> I was wondering how I could display more than 256 colors with the VGA color palette

You can not. It is a fundamental limitation of the VGA architecture. VGA may hold just that many colors at a time.

> the reason that you can't display more than 256 colors at once is because each byte in video memory corresponds to one pixel on the screen

The reason is that the VGA palette has 256 entries.

To achieve true color you must go beyond VGA modes.

nezachem 616 Practically a Posting Shark

For starters, which controller are working with?
Usually, the necessary toolchain is distributed by the manufacturer. Check on their site.

nezachem 616 Practically a Posting Shark

Post the latest code then.

nezachem 616 Practically a Posting Shark

Profiling wouldn't help on a bad algorithm, and this is the case here I am afraid. The code tries pretty much all chains on a grid, to match each against every dictionary word. Obviously most of the efforts is wasted.
My recommendation is to turn the table around, and instead try to fit dictionary words into the grid. This way you will prune the barren chains early. Most important is to preprocess the dictionary into a proper structure - take look at PATRICIA tree for example.

nezachem 616 Practically a Posting Shark

> What do you mean, nezachem?

What is name after *name++ ?

nezachem 616 Practically a Posting Shark

While "validating" (line 49 and below) you change name and text. They are not pointing to the correct places anymore.

nezachem 616 Practically a Posting Shark

Stare at lines 52 and 87 of symbol.cpp until an enlightenment descends on you.

nezachem 616 Practically a Posting Shark

To compile individual files you have to either write an individual rule for each object, or use a generic rule as

%.o: %.c
    $(CC) $(CFLAGS) -o $@ $<

(refer to automatic variables chapter in info make for the meaning of @ and <). Put this rule in place of lines 10-11.
Also be advised that your makefile does not know that main is really a target, so it would rebuild main each time, even if nothing changed. Replace all at line 7 with main.
Another recommendation is to explicitly list the source files at line 3. If you really really want make to figure that list out, use $(wildcard *.c).
Finally, you need to spell out the objfiles dependencies on .h headers (otherwise the project wouldn't rebuild on a header modification). Add a generic rule:

%.d: %.c
    $(CC) %(CFLAGS) -MM -o $@ $<

a definition of generated .d fragments:

DEPS := $(CFILES:%.c=%.d)

and include them all:

-include $(DEPS)

After that you are pretty much set. There is still a room to perfect it.

nezachem 616 Practically a Posting Shark

Sorry I am too late. The right way is indeed to use a constructor like this:

struct foo { const int value; };
struct relaxed_foo { int value; };
struct foo * init_foo(int value) {
    struct relaxed_foo * rc = malloc(sizeof(struct foo));
    rc->value = value;
    return (struct foo *) rc;
}

The struct relaxed_foo shall be kept internal to the implementation.

nezachem 616 Practically a Posting Shark

Of course. I do not expect it to be compliant; the Standard pretty much says that const qualification forbids the qualifiee (for a lack of the better word) to be a modifiable lvalue. It even makes it viral, in a sense of 6.3.2.1-1, which already makes allocation in your original snippet noncompliant. If I am right in my interpretation, my proposal wouldn't do any more harm.

nezachem 616 Practically a Posting Shark
#include <stddef.h>
...
    * (int *) (((char *) sptr) + offsetof(struct mys, value)) = 1234;
nezachem 616 Practically a Posting Shark

man fstat. Study the st_mode field.

nezachem 616 Practically a Posting Shark

When you run into that problem, you will discover that you have 10K lines of code to fix... Be safe. Read the ANSI/ISO C++ standard. They are very clear on this point.

Chapter and verse, please? 18.1-3 totally contradicts to what you say.

nezachem 616 Practically a Posting Shark

Hint #1: '=' and '==' are really different.
Hint #2: You have two constructors for CountingObserver. Which one is called at line 86?

nezachem 616 Practically a Posting Shark

Lines 163 and 190 don't do what you want them to do. Besides, the way you set up your constructors, the _subject is uninitialized.

nezachem 616 Practically a Posting Shark

Python doesn't like global variables. If you insist on using them, be explicit. Declare them as such.
As for your current arrangement, the assignment at line 13 makes Python think that strPlayer1 is a local variable - it doesn't bother to check its global existence.
Just add

global strPlayer1

to Start()

nezachem 616 Practically a Posting Shark

> how do i check ?

A preferred way is to set a breakpoint there.

nezachem 616 Practically a Posting Shark

Does line 22 ever execute?

nezachem 616 Practically a Posting Shark

> The problem is not the pointer

I suppose that now we are in the violent agreement.

nezachem 616 Practically a Posting Shark

Really sorry. Quoting seem to be messed up. More questions to Dani.

>> Sorry for annoyance. Is VC++ 2010 Express compliant?

Yes. What compiler are you using?

None.

>>I had an impression we're not talking pointers in general
That was referring to the printf() line, where the format specifer string uses %d yet only one of the 4 bytes of the integer is in the parameter list.

Huh? this one?

printf("The number is %d",*(char*)p1);

there is a pointer passed there.

nezachem 616 Practically a Posting Shark

>> Sorry for annoyance. Is VC++ 2010 Express compliant?
Yes. What compiler are you using?

None.

>>I had an impression we're not talking pointers in general
That was referring to the printf() line, where the format specifer string uses %d yet only one of the 4 bytes of the integer is in the parameter list.

Huh? this one?

printf("The number is %d",*(char*)p1);

there is a pointer passed there.

nezachem 616 Practically a Posting Shark

try to compile it. VC++ 2010 Express gives warning

Sorry for annoyance. Is VC++ 2010 Express compliant?

Not really a pointer problem

I had an impression we're not talking pointers in general. Just pointers malloc returns.

PS:

don't know about gcc. its just a wierd compiler that doesn't complain about stuff that it should.

I have a strict policy to avoid smiley faces.

nezachem 616 Practically a Posting Shark

See the code snippet I posted for clarification of what I meant.

Now I am really confused. Which snippet?

But not when typecasting the return value of malloc.

Care to elaborate? (TM)

printf() will be expecting an integer but only getting a char

It will be getting int all right.The pointer is very well aligned. On a little-endian machine it would be a right int, surprisingly.

nezachem 616 Practically a Posting Shark

Index:2 Value:Test3 // <-- From here, the data continues exist. Why?

struct t_ddclist {
   int index;
   char value[256];
   struct t_ddclist *next;
};
ddclist *createDDCList() {
   ddclist *newList = NULL;
   newList = malloc(sizeof (ddclist));
   if (!newList) {
       return NULL;
   }

   newList->index = -1;
   newList->next = NULL;
   if (!newList->value) {
       return NULL;
   }

   return newList;
}

At every createDDCList, a single block of memory is allocated. At destroyDDCList, each of them is deallocated. Deallocation loosely speaking means that the system may reuse them at its leisure. It happens so that some parts of two first blocks did get reused. The rest happened to remain intact.
Make an experiment: just for fun, declare your structure as

struct t_ddclist {
   int index;
   struct t_ddclist *next;
   char value[256];
};

and rerun your program. Explain the difference.

nezachem 616 Practically a Posting Shark

Say what?

I said it int* can't be typecast to char*.

Care to elaborate?

nezachem 616 Practically a Posting Shark

First of all, replace line 12 with the proper set of new statements.
Then, replace all cn+1 to cn.
See if it is still crashes.

After that we may continue on the triangle matter.

nezachem 616 Practically a Posting Shark

the return value of malloc could not be typecast as char* because that it the wrong type.

Confused as always. malloc returns void * , which of course can be typecasted to anything.

As for the original question:
I run the code and the O/p is 10.

Try to run it on a big-endian machine.

nezachem 616 Practically a Posting Shark

> Can anyone explain me what I'm doing wrong?

Sure.

> If I call display after destroy, the display continues showing the data after the second node.

Question is, what do you expect?
After destroy, an access to the list invokes an undefined behaviour. That is, once the list is destroyed, Do Not Touch It. Otherwise, your code is quite correct.

nezachem 616 Practically a Posting Shark

There is a Makefile. All you need to do is to type make windows or make linux (depending on what system you are on) at the command line.

nezachem 616 Practically a Posting Shark
cin>> cn;
   int M [cn][cn];

Don't do that, ever. Unfortunately it may work - but in fact you cannot initialize an array of unknown size like that.

Even if the above worked, you are using

cn+1

as loop limit. That is, the last time around, the loop counter is cn. Remember, given an array foo[10], the maximal legal index is 9.

Finally, you are not calculating a triangle... but rather a square. But for now it is least of the worries.

nezachem 616 Practically a Posting Shark

The copyright on MET claims 2001. No wonders.
There's no such thing as iostream.h anymore. It is obsoleted.

Your options are:
1. Find some fairly old compiler (they say gcc version 2.95 works... good luck with it)
2. Audit the code and get it up to the standard
3. Dump it altogether
Since MET was unmaintained for 10 years, I'd recommend Option 3.

nezachem 616 Practically a Posting Shark

Get rid of

#include "quicksort.c"
nezachem 616 Practically a Posting Shark

From what I read, no, eggs must be unpacked.

nezachem 616 Practically a Posting Shark

Take a look at McMillan's installer; looks like archives is what you are looking for.
Disclaimer: I never used it myself.

nezachem 616 Practically a Posting Shark

Not true. See description here. Specifically, The sleep() function shall cause the calling thread to be suspended....

I can answer with another man page:
sleep() makes the current process sleep until seconds seconds have elapsed

The difference seems to be in conformance to different flavors (generations?) of posix-like standards. That makes me very nervous from the protability perspective.

nezachem 616 Practically a Posting Shark
pthread_create(&th[i], NULL, func_sort, (void*)arg1);

You pass the same argument to all threads. Remember, that threads are running in the common address space, so a single copy of arg1 is shared among them. You need to create distinct individual arguments for each thread.

nezachem 616 Practically a Posting Shark

You are calling pop() twice. Replace lines 182-185 with

temp = pop(s);
    if(temp == NULL)
        return;