5,237 Posted Topics

Member Avatar for pratigya

Well some context for the code would help. Like how did you declare the num array? How did you get data into it? How did you print it out? It looks about right "as is", so I can only assume the mistake is somewhere else.

Member Avatar for Salem
0
317
Member Avatar for JoBe

> [inlinecode]typedef int **ppMYARRAY[7];[/inlinecode] Thats array of [7] pointers to pointers to int [inlinecode]typedef int *(*ppMYARRAY)[7];[/inlinecode] pointer to an array of [7] pointers to int There's a program to help with the complicated ones. [URL]http://packages.debian.org/stable/devel/cdecl[/URL] Here's an article on how to read those complex beasties. [URL]http://www.codeproject.com/cpp/complex_declarations.asp[/URL]

Member Avatar for JoBe
0
378
Member Avatar for Goldfish691

> void printarray(int **,int); > void printarray(int *array[],int); Neither of these are valid for passing a true 2D array. [code] void foo ( int **p ) { } void bar ( int *p[] ) { } void baz ( int p[][7] ) { // p[3][7] would also work } void …

Member Avatar for Goldfish691
0
116
Member Avatar for sgriffiths

First of all, your function pointer MUST be declared to be exactly the same as the function you're pointing at. Declaring int where it expects two char*'s for example isn't the way to go. Second, use typedef's for function pointers. I usually avoid typedefs for pointers, but function pointers are …

Member Avatar for Salem
0
1K
Member Avatar for JRM

> Also, this looks like it can only generate the machine code, rather than C code? True, and it's also specific to the MIPS processor as well, which means that at best, it will only turn a MIPS a.out file back into MIPS assembly, which might give you a chance …

Member Avatar for Salem
0
138
Member Avatar for yashamaru2006

> I have an idea but i am not quite sure. So explain your reasoning, and then we can tell if you're on the right track.

Member Avatar for yashamaru2006
0
85
Member Avatar for kipl20

[URL]http://www.daniweb.com/techtalkforums/thread61192.html[/URL] So have you made ANY progress at all in the last 10 days, or are you just going to keep posting the homework until you get an answer? If it's only urgent now because you've been sitting around waiting for someone else to do the work, then that's your …

Member Avatar for ~s.o.s~
0
124
Member Avatar for Clinton Portis

At the risk of stating the obvious [url]http://en.wikipedia.org/wiki/Roulette[/url] Maybe a little research on the nature of the probabilities (and the odds, which are not the same thing) is in order.

Member Avatar for Bench
0
343
Member Avatar for Mr Violent

Goto project settings and turn off precompiled headers would be my suggestion. For a feature which is supposed to improve productivity, it sure provokes an awful lot of questions from all sections of the community.

Member Avatar for Mr Violent
0
139
Member Avatar for AnG'

1. Please use the [code][/code] tags when posting code. It isn't like there aren't enough hints for you to do this. 2. You also need to give a better description of the problem than "it doesn't work" followed by simply dumping your code on the message board. How "doesn't" it …

Member Avatar for Ancient Dragon
0
159
Member Avatar for rQQt

Seen it [url]http://forums.devshed.com/c-programming-42/problem-with-selection-sorting-program-403357.html[/url]

Member Avatar for Salem
0
96
Member Avatar for swathi.s

Post your code, then perhaps we can tell you where you went wrong. Don't forget to use the tags around your code.

Member Avatar for iamthwee
0
130
Member Avatar for kasun_04

Well if you do [code] pid = fork(); if ( pid == 0 ) { // in child, do child specific stuff } else if ( pid != -1 ) { // in parent, do parent specific stuff } else { // in parent, but fork failed } [/code] Then …

Member Avatar for Salem
0
126
Member Avatar for dev.cplusplus

Sort of possible, but not recommended [code] #include <iostream> #include <string> #include <cstdlib> using namespace std; void MyFunc(int **my_array) { for ( int i=0; i<10; i++) (*my_array)[i] = i; } int main() { int int_array[10]; int *temp = int_array; MyFunc( &temp ); // was &int_array cout << int_array[0] << " …

Member Avatar for Ancient Dragon
0
122
Member Avatar for CurtisBridges

Yes, start a new thread, and this time make sure you use the code tags. Do you see the watermark in the background of the edit window, telling you how to use code tags? Have you even read this - [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Did you bother to press "preview" before "submit" ?

Member Avatar for Salem
0
133
Member Avatar for astrojith

> but she has no idea what she's teaching. We get that a lot. [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376[/url] It's only crappy DOS compilers which ever had this, presumably because DOS was so crappy at dealing with the return value that nobody ever cared. All real compilers only accept int main, which is the …

Member Avatar for chunkmartinez
0
496
Member Avatar for confused!

> [COLOR=#b1b100]switch[/COLOR] [COLOR=#66cc66]([/COLOR]number[COLOR=#66cc66])[/COLOR] With a suitable table of values (ie, an array), you could do all this with one line [inlinecode]board ^= table[number];[/inlinecode]

Member Avatar for Salem
0
98
Member Avatar for toche
Member Avatar for balgarath

> char name[]; This isn't some "magic" variable length array you can just scribble chars into with strcpy. Making it char* won't help much either, unless you want to manage memory yourself. Personally, I'd go with [inlinecode] std::string name;[/inlinecode] Then your member functions can be like this [code] Player( std::string …

Member Avatar for Salem
0
156
Member Avatar for JRM

> undefined reference to `WinMain@16' It definitely thinks it is a GUI program somewhere along the line.

Member Avatar for Salem
0
76
Member Avatar for mozira
Member Avatar for Salem
0
172
Member Avatar for mattyd

This [code] void func() { static int i = 0; cout << "i = " << ++i << endl; } [/code] Is like this [code] static int i = 0; void func() { cout << "i = " << ++i << endl; } [/code] With the exception that the scope …

Member Avatar for Salem
0
153
Member Avatar for linq

> i wouldn't use atoi. Try stringstream. Yes! use a string stream if you're using C++. If you must use a C function, at least use strtod() which has some error checking capabilities.

Member Avatar for Salem
0
134
Member Avatar for sbenware

> I have a function to find out if a number is prime or not. Which isn't working. > bool isPrime(int n); Where is your implementation of this function? This is step 1 [code] bool isPrime(int n); int main ( ) { for ( int i = 1 ; i …

Member Avatar for sbenware
0
315
Member Avatar for mattyd

> "Indenting? Nah, that's a waste of time-- I don't care if its all pretty. It just matters that it runs." That might work in the "write once, read once, run once" code which is the average student assignment, but in industry where code has a much longer lifetime (and …

Member Avatar for vegaseat
0
323
Member Avatar for hui

A fat lot of good that did! Added code tags, but it's still unindented crap. > [B][B][B]I would liike to multiply two matrices but my code is not working..help me out![/B][/B][/B] Post a proper question. Don't just dump the code and hope someone will figure it out. Does it compile? …

Member Avatar for Salem
0
141
Member Avatar for coool_rahul

Opening the same file for input and output at the same time is not a good idea. open for read read it close it do stuff open for write write it close it.

Member Avatar for Salem
0
759
Member Avatar for anandarose
Member Avatar for anandarose
0
253
Member Avatar for phuduz

Since check is a boolean, you may as well do [INLINECODE] if ( check )[/INLINECODE] I personally dislike the swapping over of variables in an attempt to get an error message on the mis-use of =

Member Avatar for may4life
0
82
Member Avatar for pointers

There's nothing which states all pointers must be the same size [url]http://c-faq.com/null/machexamp.html[/url]

Member Avatar for Salem
0
97
Member Avatar for Haktivex

> HWND hTemp = FindWindow("tibiaclient", NULL); The newer compilers use UNICODE by default. I think you can either turn this off. Or prepare your code for the future by writing HWND hTemp = FindWindow( _TEXT("tibiaclient"), NULL); [URL="http://www.i18nguy.com/unicode/c-unicode.html"]http://www.i18nguy.com/unicode/c-unicode.html[/URL]

Member Avatar for Haktivex
1
191
Member Avatar for rati

> i m wrking on linux Most shells do this for you, the usual question being "how do I turn OFF" wildcard expansion. If you have a.txt b.txt and c.txt in your directory, then doing myprog *.txt Will invariably result in your program seeing argv[1] = "a.txt" argv[2] = "b.txt" …

Member Avatar for rati
0
112
Member Avatar for tlly

[code] // file = fopen(filename.c_str()); // MAKE CODE CHANGE HERE char ch; // char ch; int counter = 0; // int counter=0; char* str; // string str; while(!(feof(file))) // { do { ch = fgetc(file); str = str + ch; [/code] Well the first thing is to decide whether you're …

Member Avatar for iamthwee
0
189
Member Avatar for SlightlyAngelic

> scanf[COLOR=#66cc66]([/COLOR][COLOR=#ff0000]"%f"[/COLOR],loan[COLOR=#66cc66])[/COLOR]; You forgot the &, like [INLINECODE]scanf[COLOR=#66cc66]([/COLOR][COLOR=#ff0000]"%f"[/COLOR], &loan[COLOR=#66cc66])[/COLOR];[/INLINECODE] Ditto for the years. You also need to call your Mortgage_Calc function at some point.

Member Avatar for Salem
0
133
Member Avatar for pointers

The inner printf is missing an int parameter to make the %d do something meaningful!

Member Avatar for ~s.o.s~
0
102
Member Avatar for Raj@web

Search harder? [url]http://clusty.com/search?query=convolution+dsp+c+source+code[/url]

Member Avatar for Salem
0
100
Member Avatar for kimw

> putting in the comma and quotes are certainly not the most pleasant things to do Wrap it up in a class :) Probably not a bad idea if you need to do this a lot.

Member Avatar for Salem
0
136
Member Avatar for neeven

Reposted again (or was it before) [url]http://www.daniweb.com/techtalkforums/thread59090.html[/url] Anyway, this dupe is closed.

Member Avatar for Salem
0
287
Member Avatar for Lutzee

> and still get fn() to recognise its existance? Pass it as a parameter. Unless this is one of those futile exercises that some tutors seem to love (for god-knows what reason), and the answer usually involves some horridness involving macros. If this is the case, then perhaps consider a …

Member Avatar for Salem
0
123
Member Avatar for aismm

Having read a line from the user, you normally have to remove the newline before trying to use it as a filename. [code] if ( fgets( buff, sizeof buff, stdin ) != NULL ) { char *p = strchr( buff, '\n' ); if ( p ) *p = '\0'; fp …

Member Avatar for andor
0
218
Member Avatar for chris.lloyd

To open a file in binary mode [inlinecode] FILE *fp = fopen("image.bin","rb");[/inlinecode] To read a byte from the file [inlinecode] int ch = fgetc( fp ); if ( ch != EOF ) { /* do something */ }[/inlinecode] Reading the whole file extends to [inlinecode]while ( (ch=fgetc(fp)) != EOF )[/inlinecode] …

Member Avatar for chris.lloyd
0
173
Member Avatar for shariq
Re: C

The web (for want of being searched) has several articles on how to get something 'OO' going in C. [url]http://clusty.com/search?query=oop+in+c&sourceid=Mozilla-search[/url]

Member Avatar for Salem
0
37
Member Avatar for boule

> I need a general answer, not depending on any code... If you're looking to get things like the return address, base pointer and stack pointer say, then there is NO general answer. It is very compiler specific, right down to which set of compiler flags you specify.

Member Avatar for Salem
0
162
Member Avatar for joyce_16jo

> while (num=0) Use == for comparison, = is for assignment Though you probably want != > return (sum); Think - would this be better inside or outside of the loop. > reverse(int num); This just prototypes the function again. Try say [inlinecode] sum = reverse( num );[/inlinecode]

Member Avatar for Salem
0
98
Member Avatar for nick937

Because you need to look-ahead, it's probably better to read the whole string into memory. Then if you're looking at an 'i', you can look at the next character to see whether it is another 'i', or a 'v' or an 'x', then decide what to do about it.

Member Avatar for ~s.o.s~
0
107
Member Avatar for Mangai

[code] class DownSample { public: Matrix *downSmple(Matrix *Image); } ; // <----- this ; is MISSING [/code]

Member Avatar for Mangai
0
221
Member Avatar for kimw

How long does an empty loop take? [code] while (getline(inFile, s)) { } [/code] Separate the "time to read the file" from the time to "tokenise the file". It it takes <1 second, then there might be something you can do. If it takes >3 seconds, then all your tokenising/vector …

Member Avatar for kimw
0
92
Member Avatar for Line

> printf(" user time: %d microseconds\n", sutime); Go read the manual page for printf conversions again - %d is NOT for doubles. If you're using gcc as your compiler, then add these flags to the command line [INLINECODE]gcc -W -Wall prog.c[/INLINECODE] It will then tell you when the printf/scanf format …

Member Avatar for Line
0
202
Member Avatar for nimmi

> int binconvert (intNum) 1. Give the parameter a type - say int 2. Actually use the parameter inside the function.

Member Avatar for Infarction
0
125
Member Avatar for BombAppetit
Member Avatar for Salem
0
108

The End.