1,494 Posted Topics
Re: try g++ Numbers.cpp -c g++ Main.cpp -c g++ Numbers.o Main.o -o main | |
Re: Try using(including) the limits.h header file into your program. | |
Re: Here's a question. How big can a character variable get? | |
Re: 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 … | |
Re: The easiest way, allocate a new larger memory block(array) and then copy the array into it. | |
Re: 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] | |
Re: 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] | |
Re: Look at line 15. [code] void del_singlechild(): [/code] Your using a : and not a ; | |
Re: 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. | |
Re: The C Programming Language by Brian W. Kernighan, Dennis Ritchie | |
Re: Before I spent anymore time on this question, could you please state what line number you are talking about. | |
Re: 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]->", … | |
Re: 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. | |
Re: 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) { … | |
Re: [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, … | |
Re: Are you talking about a console program? If you are then you'll have to state which operating system. | |
Re: [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. | |
Re: Just curious. What C compile allows main to have no return type? | |
Re: 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. | |
Re: 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] | |
Re: [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 … | |
Re: 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 … | |
Re: Try creating a == operator, something like below [code] bool operator ==(const Sample & s) { return a == s.a; } [/code] | |
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 … | |
Re: 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. | |
Re: 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, … | |
Re: [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 … | |
Re: 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. | |
Re: Your kidding right? You want us to read the docs to you? | |
Re: You should be able to use iterators. | |
Re: Only if he/she likes a pointer that refers to invalid memory(int 'a' becomes invalid when the function 'check' returns). | |
Re: [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 … | |
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 … | |
Re: 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] | |
Re: Could you explain what's not working so we can understand what the problem is. | |
Re: Maybe it would help to look at what 258 is in binary 00000001 00000010 Which is 1 and 2. | |
Re: Just compiled and ran your code using gcc, it worked fine. | |
Re: [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. | |
Re: 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] == … | |
Re: Typing is good, it allows the compiler to enforce its type restriction. That's good by the way. | |
Re: I googled c++ string and got this [url]http://www.cplusplus.com/reference/string/string/[/url] | |
Re: I would check the multimap container. [url]http://www.cplusplus.com/reference/stl/multimap/[/url] | |
Re: 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); … | |
Re: 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 … | |
Re: 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 … | |
Re: Do you require a closing brace on line 962(a closing brace after the break on line 962)? | |
Re: Pointers are data variables that store(that should store) NULL or a valid memory address. Pretty simple right? |
The End.