1,494 Posted Topics

Member Avatar for phorce
Member Avatar for phorce
0
154
Member Avatar for gauravrishi
Member Avatar for geeksforgeek
Member Avatar for Narue
0
104
Member Avatar for kaleam
Member Avatar for Troebadoer

If your not using the unsafe keyword, I doubt you have a memory leak or a memory leak that you cam fix(i.e. It may be a problem with the database api). Note: I wouldn't base memory leaks solely on the task manager's memory indicator since C#'s garage collector isn't consistent …

Member Avatar for Troebadoer
0
229
Member Avatar for nerdygirl118

The easiest way, allocate a new larger memory block(array) and then copy the array into it.

Member Avatar for nerdygirl118
0
295
Member Avatar for shamusk

I would multiply both your example numbers(0.60 and 0.69) by 100 and go from there. You might find some help here.. [url]http://www.daniweb.com/software-development/c/threads/346402[/url]

Member Avatar for shamusk
0
180
Member Avatar for techie929

Your using a character pointer that hasn't been initialized. Line 8 should be [code] char* pStr = (char*)malloc(200 * sizeof(char)); /*check allocation here*/ [/code]

Member Avatar for techie929
0
111
Member Avatar for ROCK_ST@R
Member Avatar for D33wakar
0
229
Member Avatar for fullarmorzz

Well we're not writing the code for you. What have you written so far? To calculate even or odd numbers you would use the modulus operator and for your loop, you could use either a while or a for loop.

Member Avatar for ashok1514
0
203
Member Avatar for resell4
Member Avatar for ashok1514
1
161
Member Avatar for dimmu11

Before I spent anymore time on this question, could you please state what line number you are talking about.

Member Avatar for WaltP
0
133
Member Avatar for mdegges

Not really sure what you program's purpose is, are you trying for something like below? [code] #include <stdio.h> int main() { int i = 0, size = 0; printf("Enter the size of the arrays->"); scanf("%d", &size); int array1[size]; for (i = 0; i < size; ++i) { fprintf(stdout, "Enter element[%d]->", …

Member Avatar for mdegges
0
8K
Member Avatar for Aman6o

Look at line 6. Your incrementing a[1] which equals 3 by 1 so i = 4. Look at line 8. Your incrementing i so that would make i = 5.

Member Avatar for Narue
1
146
Member Avatar for rockerjhr

I think this is what you want [code] #include <iostream> class m1 { public: virtual void display_it(void) const { std::cout << "from m1" << std::endl; } }; class m2:public m1 { public: void display_it(void) const { std::cout << "from m2" << std::endl; } }; int main(int argc, char** argv) { …

Member Avatar for Fbody
0
196
Member Avatar for bizcat

[code] #include <stdio.h> #include <stdlib.h> #include <string.h> void heapstrings(void) { char *p1 = (char*)malloc(sizeof(char[13])); char *p2 = (char*)malloc(sizeof(char[13])); //check here to see if malloc failed. strcpy(p1, "Clydefrog"); strcpy(p2, "Cartman"); printf("p1 is pointing on string %s at adress %p\n", p1, (void*)p1); printf("p2 is pointing on string %s at adress %p\n", p2, …

Member Avatar for gerard4143
0
182
Member Avatar for Ich bin würdig

Are you talking about a console program? If you are then you'll have to state which operating system.

Member Avatar for Narue
0
172
Member Avatar for xxmp

[QUOTE=Narue;1651734] but ultimately it isn't worth the effort for a weak facsimile of function overloading.[/QUOTE] Wow you got function overloading from the original posting? You must be psychic.

Member Avatar for xxmp
0
130
Member Avatar for J_17
Member Avatar for D.M.
0
71
Member Avatar for hopper24

Instead of posting your homework assignment(and breaking forums rules) why don't you repost your code correctly and state what's not working and where its not working.

Member Avatar for hopper24
0
206
Member Avatar for J_17
Member Avatar for Zssffssz

Not sure what your trying to accomplish in your code but you could investigate the rename function that resides in cstdio or stdio.h. [code] int rename(const char *oldpath, const char *newpath); [/code]

Member Avatar for raptr_dflo
0
154
Member Avatar for dgreene1210

[QUOTE=dgreene1210;1651270]This is my header file i want to use [CODE]#include "my.h" #include <stdio.h> void read_data(int* length, int* width, int* customerdiscount, double* costpersquarefoot) { printf("Length of room (feet)?"); scanf("%d\n", *length);//should be scanf("%d\n", length); printf("Width of room (feet)?"); scanf("%d\n", *width);//should be scanf("%d\n", width); printf("Customer discount (percent)?"); scanf("%d\n", *customerdiscount);//should be scanf("%d\n", customerdiscount); printf("Cost …

Member Avatar for gerard4143
0
171
Member Avatar for asitmahato

I'm not sure if the gcc compiler has that option. The ld(GNU linker) can change the entry point label but its default is _start and it won't apply to your code. ld -e entry --entry=entry Use entry as the explicit symbol for beginning execution of your program, rather than the …

Member Avatar for L7Sqr
0
2K
Member Avatar for Anirudh Rb

Try creating a == operator, something like below [code] bool operator ==(const Sample & s) { return a == s.a; } [/code]

Member Avatar for Fbody
0
78
Member Avatar for gerard4143

I'm really new to C# so this may seem like a novice question..How does C# accomplished passing a reference to a object reference? I'm really trying to understand the underlying mechanisms and how it applies to the attached code with the comments - //what happens here? Do we pass a …

Member Avatar for Ketsuekiame
0
262
Member Avatar for D.M.
Member Avatar for cse.avinash

Try this [code] #include <stdio.h> int main(void) { printf("%lu %lu",sizeof((unsigned char)'A'),sizeof("A")); return 0; } [/code] A character literal has type int.

Member Avatar for gerard4143
0
97
Member Avatar for RideFire

Here's an example that works on my AMD/64 bit machine. testit.cpp [code] #include <iostream> extern "C" int sum(int, int);//to avoid name mangling int main() { std::cout << sum(3, 4) << std::endl; return 0; } [/code] asm_file.s [code] .section .data .section .bss .section .text .global sum sum: pushq %rbp movq %rsp, …

Member Avatar for raptr_dflo
0
236
Member Avatar for Zssffssz

[QUOTE=Zssffssz;1649487]I herd that some C++ compilers can use asembly languige in there programs along side C++, How would I do This? And is there any way to use a compiler as an assembler? <<two questions.[/QUOTE] How do you integrate assembly into C++? Generally most compilers provide inline assembly as an …

Member Avatar for gerard4143
0
181
Member Avatar for UrbanBourbon

Shouldn't this line be if((strcmp(first, workers[L].first) == 0) && (strcmp(last, workers[L].last) == 0)) calling strcmp twice. Also your error...first and last are characters not c-strings.

Member Avatar for Narue
0
2K
Member Avatar for geeksforgeek
Member Avatar for D.M.
0
144
Member Avatar for coolbeanbob
Member Avatar for dellat

Only if he/she likes a pointer that refers to invalid memory(int 'a' becomes invalid when the function 'check' returns).

Member Avatar for dellat
0
174
Member Avatar for N1GHTS

[QUOTE=N1GHTS;1648056]Lets say I have a shared library in Linux, written in C, with a single function that simply returns the pointer to a string literal. [code]void *ReturnObject() { return (void *)"\xFA\x03\x44\x10\xE0"; }[/code] When this library is loaded by the host application at runtime and this function is called, is the …

Member Avatar for N1GHTS
0
152
Member Avatar for gerard4143

Hi, I have an odd problem...well an annoying problem. My internal hard drive is read only which is O.K. unless you need to write to it or say boot it. So what happened? I really don't know, I sent my computer to get some maintenance done on it because it …

Member Avatar for flagstar
0
153
Member Avatar for geeksforgeek

Think of a void pointer as a dimensionless pointer. It has to be cast to a data type with a dimension before it can be referenced...Like below. [code] int x = 5; void *vptr = (void*)&x; int *iptr = (int*)vptr; fprintf(stdout, "*iptr->%d\n", *iptr); [/code]

Member Avatar for geeksforgeek
0
124
Member Avatar for zendet
Member Avatar for frogboy77
0
145
Member Avatar for saurav2007

Maybe it would help to look at what 258 is in binary 00000001 00000010 Which is 1 and 2.

Member Avatar for saurav2007
0
124
Member Avatar for RideFire
Member Avatar for RideFire
0
98
Member Avatar for Vusumuzi

[QUOTE=Vusumuzi;1647320]Hello I'm looking for a javascript I can use to rotate my 10 images on 10 seconds interval.[/QUOTE] Wow your a long way from home...Try posting under the Web Development section.

Member Avatar for Vusumuzi
0
97
Member Avatar for Jamblaster

Save lots of RAM? Not really. Here's a union example to find the byte order of a system. [code] #include <iostream> int main(int argc, char**argv) { union { short s; char c[sizeof(short)]; } un; un.s = 0x0102; if (sizeof(short) == 2) { if ( un.c[0] == 1 && un.c[1] == …

Member Avatar for rubberman
0
493
Member Avatar for geeta_11

Typing is good, it allows the compiler to enforce its type restriction. That's good by the way.

Member Avatar for Narue
0
104
Member Avatar for TheNNS

I googled c++ string and got this [url]http://www.cplusplus.com/reference/string/string/[/url]

Member Avatar for gerard4143
0
139
Member Avatar for imcgrath1
Member Avatar for mike_2000_17
0
3K
Member Avatar for saurav2007

Not sure why your handling your pointer that way? Try writing your program like below: [code] #include <stdio.h> #include <stdlib.h> #define ELEM_POS 2 int main(int argc, char** argv) { int x[] = {1, 2, 3, 4}; char *p = (char*)x; fprintf(stdout, "p->%d\n", *(int*)p); p = (char*)(p + sizeof(int) * ELEM_POS); …

Member Avatar for cse.avinash
0
195
Member Avatar for Cainer

You may be wondering why two + operators are required? Try reading this link, it may clear up some of your confusion. [url]http://www.bogotobogo.com/cplusplus/this_pointer.html[/url] I should clarify that Mike 2k's solution doesn't require this explanation because both + operators are defined outside of the class Number but if you had a …

Member Avatar for gerard4143
0
235
Member Avatar for Steven_gerrard

Here's a simple example that'll work with a ascii text file. [code] #include <iostream> #include <fstream> struct mys { char ca[10]; unsigned long a, b; } thes; std::ifstream& operator >>(std::ifstream & in, struct mys & s) { in >> s.ca; in >> s.a; in >> s.b; return in; } int …

Member Avatar for raptr_dflo
0
162
Member Avatar for iAMyours

Do you require a closing brace on line 962(a closing brace after the break on line 962)?

Member Avatar for raptr_dflo
0
180
Member Avatar for hackit

Pointers are data variables that store(that should store) NULL or a valid memory address. Pretty simple right?

Member Avatar for cse.avinash
0
164

The End.