3,183 Posted Topics

Member Avatar for rpittala

What are the advantages of a single pointer? Answer that and then you have the answer for double, triple, quadruple, etc. pointers.

Member Avatar for deceptikon
0
36
Member Avatar for Drezta

[QUOTE]Hypotheticaly, if you have a large object that is needed almost everwhere within a program and this object is used for accessing data. Is it better to pass the object by referance into each function that needs it, or to make the object static?[/QUOTE] Hypothetically, I'd question whether that large …

Member Avatar for deceptikon
0
113
Member Avatar for Karlwakim

They're hexadecimal. 0x is a common prefix for hexadecimal. You'll also see a suffix of h. But the telltale sign is letters.

Member Avatar for jacklogan
0
153
Member Avatar for urbanthistleuk

If the checkbox should be checked, add checked="checked" to the input tag attributes: [code] <input type="checkbox" name="foo" value="1" <?= $foo ? 'checked="checked"' : '' ?> > [/code]

Member Avatar for urbanthistleuk
0
154
Member Avatar for ram619

%s prints the whole string. If the starting point for the string steps ahead by one character each iteration, you basically chop off the first character each time. [code] char const* x = "Alice"; printf("%s", x); // "Alice" ++x; printf("%s", x); // "lice" ++x; printf("%s", x); // "ice" ++x; printf("%s", …

Member Avatar for ram619
0
101
Member Avatar for Smartflight

[QUOTE]That's because you are new and haven't developed the keen Spidey Programming sense yet. It'll come...[/QUOTE] How long does that take? Because I've been programming for well over 10 years and still have a dull Spidey sense. :D

Member Avatar for WaltP
0
558
Member Avatar for ram619

The for loop is completely nonsensical. It's like this: [code] for (initialization; condition; increment) { body } [/code] Where the roughly analogous while loop is: [code] initialization while (condition) { body increment } [/code] So your loop, [icode]for(i<=5&&i>=-1;++i;i>0) printf("%u",i);[/icode] would look something like this while loop: [code] i <= 5 …

Member Avatar for ram619
0
121
Member Avatar for venky019

The compiler is right. Sports is a class name, and you can't use it to call a non-static method. To call getName() you first need to create an object of the Sports class.

Member Avatar for Ancient Dragon
0
3K
Member Avatar for arunsolo1984

The [B]text[/B] of a macro argument is used, not the value of the variable. So after expansion the statement is: [code] int i = ++x * ++x; [/code] On top of being undefined behavior, that's probably not the logic you intended. Any expressions with side effects should be avoided as …

Member Avatar for deceptikon
0
108
Member Avatar for issaru07

If you're not getting any errors but the image is broken, the URL is probably wrong. First make sure that $pic represents a file name that exists in the site_images directory, then make sure that that whole URL is accessible to the page as written.

Member Avatar for pzuurveen
0
284
Member Avatar for LucyButterfly22

I don't have any tips because you didn't explain what the program is supposed to do. It's not safe to assume that anyone here knows what an anti-saccade task is, much less infer your program's requirements from that even if they did.

Member Avatar for DeanMSands3
0
109
Member Avatar for DonnieT2

It all looks good to me. To answer G, your answer for D will help. Just remember that it's a nested loop and the solution will be apparent. :)

Member Avatar for DonnieT2
0
341
Member Avatar for sharathg.satya

[QUOTE=sharathg.satya;1742733]I saw this example while i am searching about vectors.. [CODE] vector<double> student_marks; // no size specified: vector contains // no elements int num_students; cout << "Number of students: " << flush; cin >> num_students; student_marks.resize (num_students); for (vector<double>::size_type i = 0; i < num_students; i++) { cout << "Enter …

Member Avatar for sharathg.satya
0
118
Member Avatar for pseudorandom21

May I suggest the OpenPOP library? I've used it in several projects and haven't had any problems yet.

Member Avatar for pseudorandom21
1
1K
Member Avatar for Aphrite

[QUOTE=BobS0327;1742201]The solution to your problem is to use the memcmp function as a comparison of your structures. I do realize that this is somewhat of an unorthodox solution. But it does work. I did put together some proof of concept code to verify that it does in fact work. Unfortunately, …

Member Avatar for BobS0327
0
186
Member Avatar for sharathg.satya

[QUOTE=sharathg.satya;1742626]Is it an old idea to compile and run c programs on turbo c?[/QUOTE] Yes, by about 15 years. Visual C++ is freely available, Code::Blocks comes with a recent gcc build, and I hear Pelles C is good too. There are more, but those are the three most common recommendations.

Member Avatar for DeanMSands3
0
178
Member Avatar for paulhook
Member Avatar for ifrah qaisar

[URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Daniweb's Rules[/URL]

Member Avatar for deceptikon
-1
45
Member Avatar for sharathg.satya

[QUOTE=sharathg.satya;1742515]ok the only reason is it may cause problem when it is used in any other compiler or version[/QUOTE] There are two big reasons: [list=1] [*]The new operator calls constructors and the delete operator calls destructors. malloc() and free() only work with raw memory. So if you use malloc() to …

Member Avatar for deceptikon
0
183
Member Avatar for richardtreier

If it's not a library that was built for Windows, you won't be able to use it.

Member Avatar for mike_2000_17
0
109
Member Avatar for Nikhar

The assembler would be written in another language first, possibly a different assembly language or even a higher level language like C. Then it's not uncommon after that for the assembler to compile/bootstrap itself as a way of shaking out bugs and proving viability of the tool. And since it's …

Member Avatar for deceptikon
0
182
Member Avatar for Nikhar

[QUOTE]As a matter of fact the output of my quicksort program is correct.[/QUOTE] Unfortunately, in C "working" is not a guarantee of correctness. The swap process is undefined. Take [ICODE]a[hi]=a[pivot]+a[hi]-(a[pivot]=a[hi]);[/ICODE] as an example. In C you can't assign to a variable and then use it again for anything except to …

Member Avatar for deceptikon
0
114
Member Avatar for justzamir
Member Avatar for justzamir
0
599
Member Avatar for northrox

It all depends on how the file is formatted and how deeply you want to scan. If the int is a word of its own and not part of a larger word, you can just read words and check for the int: [code] #include <stdbool.h> #include <stdio.h> bool is_int(char const* …

Member Avatar for deceptikon
0
123
Member Avatar for mylotech

I wouldn't use recursion for this, but that doesn't mean your way is wrong if it does the job.

Member Avatar for mazzica1
0
258
Member Avatar for degroundshaker

[URL="http://stackoverflow.com/questions/757675/website-screenshots-using-php"]Website screenshots using PHP[/URL].

Member Avatar for mschroeder
0
154
Member Avatar for phorce

[QUOTE][CODE]double **matrix = new double*[rows*sizeof(double*)];[/CODE][/QUOTE] This line declares a new matrix variable that hides the one defined in your class. After the constructor runs, the matrix variable defined in your class is still uninitialized. [QUOTE][CODE]for(int i=0, j=0; (i < rows, j < columns); i++, j++)[/CODE][/QUOTE] I don't think this does …

Member Avatar for phorce
0
1K
Member Avatar for mrprassad

It totally depends on how the compiler organizes memory. In gcc the string literal "%s" is stored after the string literal "dcis" in memory, so overrunning the string prints "%s". You can test it like this: [code] #include <stdio.h> int main(void) { const char *before = "before"; const char *p …

Member Avatar for Moschops
0
200
Member Avatar for XO39

[QUOTE=Captain Jake;1741047]What i asked is, how to write the the code, which don't give a undefined behavior still giving the correct output for this exact question.[/QUOTE] The undefined behavior comes from modifying the same variable more than once in the same expression. To get rid of undefined behavior, first figure …

Member Avatar for XO39
0
179
Member Avatar for mitrious

If the constructor depends on a pointer then it should make a copy in all cases or in no cases. That way the class is guaranteed to always own the pointer and deleting it is safe, or the pointer is always assumed to be owned by an external entity and …

Member Avatar for deceptikon
0
5K
Member Avatar for ddanbe

Why not use String.Replace()? [code] string NewDate = Date.Replace(".", string.Empty); [/code]

Member Avatar for ddanbe
0
1K
Member Avatar for DezineGenerator

The = operator is for assignment in C++. You want the == operator to compare equality: [code] for (x = 0; x <= y; x++) { if (a == x || b == x || c == x) { printf("Value = %d", x); } } [/code]

Member Avatar for DezineGenerator
0
431
Member Avatar for newbiecoder

Strings are immutable in C#. If you want something more like an array, use a StringBuilder object: [code] var x = new StringBuilder("Daniweb"); x[3] = 'k'; Console.WriteLine(x.ToString()); [/code]

Member Avatar for newbiecoder
0
101

The End.