1,494 Posted Topics

Member Avatar for pg5678

Technically speaking, the only difference between code and data are memory attributes. So an array could carry values that equate to a function calls but you could not call them unless you changed the memory attributes to read/execute and pointed the instruction pointer at them..

Member Avatar for gerard4143
0
147
Member Avatar for TheWolverine

This is how I would solve this problem [code] #include <iostream> class BaseClass { public: BaseClass( ){ } ~BaseClass( ){ } double getitsvalue() const { return value; } void setitsvalue(double val) { value = val; } protected: double value; }; class DerivedClass : public BaseClass { public: DerivedClass( ) { …

Member Avatar for TheWolverine
0
353
Member Avatar for sgw
Member Avatar for cutedipti

[QUOTE=VIKRAM KARKI;1487744]hi im vikram my question is WEATHER A NULL CHARACTER OCCUPY ANY SPACE IN MEMORY IF YES THAN HOW MUCH SPACE IT NEEDED?[/QUOTE] Why are you resurrecting an old thread(Oct 4th, 2008) and why the CAPS?

Member Avatar for gerard4143
0
275
Member Avatar for pato wlmc

A make file is just a list of instructions for the compiler and linker. If your interested try googling make file tutorial or check here [url]http://mrbook.org/tutorials/make/[/url]

Member Avatar for pato wlmc
0
118
Member Avatar for hantuapi

You actually got this to compile with a C compiler? How did you manage that? Your structure and array of structures should be set up like below. [code] struct menuItemType { char *menuItem; double menuPrice; }; struct menuItemType order[10] = { {"Plain Egg",2.50}, {"Bacon and Egg",3.45}, {"Muffin",2.20}, {"French Toast",2.95}, {"Fruit …

Member Avatar for chrjs
0
127
Member Avatar for VP2
Member Avatar for efronefron

Any memory that you allocate should be also freed and since your returning a pointer to the allocated memory, you can use that to free it. Also, why all the comments its really distracting.

Member Avatar for WaltP
0
214
Member Avatar for lochnessmonster

Use the function fgets(). char *fgets(char *s, int size, FILE *stream);

Member Avatar for navedalam
0
75
Member Avatar for b56r1

Because j is a local variable it takes whatever value that happens to be on the stack...To fix this initialize j to 0 [code] int j = 0; [/code]

Member Avatar for gerard4143
0
120
Member Avatar for InLondon76

A multi-thread program that's shares common data amongst the threads can run bug free on a single core CPU but fail on a multi-core CPU..How do you correct this situation? You anticipate and correct the possibility of two or more threads writing/reading common data by using a mutex or semaphore.

Member Avatar for template<>
0
325
Member Avatar for fpsasm
Member Avatar for Forthright

You could use [code] buf = const_cast<char*>(ConstBuffer); [/code] but using a cast to get your code to work is a good indicator of poorly written code.

Member Avatar for Forthright
0
346
Member Avatar for AutoPython
Member Avatar for andy.apple
Member Avatar for andy.apple
0
141
Member Avatar for andylbh

I'm not sure what C compiler your using but you should use one that's modern.. these lines are wrong [code] read(clientFd,lowerLimit); read(clientFd,upperLimit); write(clientFd,sumOfPrimes(lowerLimit,upperLimit)); [/code] ssize_t read(int fd, void *buf, size_t count); ssize_t write(int fd, const void *buf, size_t count); Please note the number of arguments.

Member Avatar for gerard4143
0
2K
Member Avatar for DaniwebOS
Member Avatar for ac20734

If I was attacking this problem I would create two functions. The first one would find the starting position and the second one would be my recursive function. Also, will the path through the array have loops in it?

Member Avatar for gerard4143
0
236
Member Avatar for ac20734

First hint: create an enumerated set like below [code] enum Direction {Left, Right, Top, Bottom}; [/code] Use these values to inform the recursive function where its being called from. This keeps the direction moving down the path and not doubling back.

Member Avatar for gerard4143
0
158
Member Avatar for Dexxta27

[QUOTE=Dexxta27;1479386]why do you use call input twice, using the increment?[/QUOTE] He's showing you two equivalent ways of doing the same thing.

Member Avatar for Dexxta27
0
154
Member Avatar for Frederick2

The GCC compiler has this option built in, just compile with this option -ftime-report example: g++ filename.cpp -ftime-report -o filename

Member Avatar for Frederick2
0
358
Member Avatar for MatGreenfield

Line 34 should be [code] writeRes = write(fd_out,genBuffer,bufsize); [/code]

Member Avatar for MatGreenfield
0
101
Member Avatar for paulkinzelman

I found this link, it explains how to create a dll with mingw and if you scroll down to the bottom of the page you'll find a link for calling your dll from C#. [url]http://www.adp-gmbh.ch/win/misc/mingw/dll.html[/url]

Member Avatar for paulkinzelman
0
307
Member Avatar for Crutoy

You might also want to do something if the guess is too high, too low or correct. example: you enter a random number say => 765 The computer guesses 500 which is too low so the next number is one half of the high range => 750...and this continues, taking …

Member Avatar for Crutoy
0
801
Member Avatar for sdr001
Member Avatar for sdr001
0
112
Member Avatar for mskittles

Your going about this the wrong way, to initialize an array you must access each element..Like so [code] #include<iostream> #include <vector> using namespace std; int main() { double l1=25.0, l2=5.0, l3=20.0, l4=10.0, x1; int array1[13]; int i = 0; for(x1=0.0; x1<361.0; x1+=30.0) { array1[i++] = x1; } for(i = 0; …

Member Avatar for gerard4143
0
94
Member Avatar for Tripandthenfall

You have a couple of problems in your code. You should call the pow() like this [code] S=pow(M/I, M*Y); [/code] result is used uninitialized here [code] S = result + 1 * D; [/code]

Member Avatar for gerard4143
0
87
Member Avatar for KazenoZ

Can you do it? Yes, its just a matter of building a string or strings containing the the compiler name and proper switches plus the files in question and then calling system(created_string).

Member Avatar for KazenoZ
0
147
Member Avatar for GmatCat

Please use code tags and proper formating. The problem, don't define your function inside of main.

Member Avatar for gerard4143
0
75
Member Avatar for spoonlicker

[QUOTE=spoonlicker;1477846]I'm not. I'm seriously waiting for an answer. It's not wasting peoples' time if they are supposedly here to help.[/QUOTE] You do realize that an 'equivalent' value can be represented as a integer, octal, hexadecimal or binary...You realize that right? So you can write raw machine code with a hex …

Member Avatar for spoonlicker
0
3K
Member Avatar for iamthesgt

The container list has a merge member function, I would look up its functionality. [url]http://www.cplusplus.com/reference/stl/list/merge/[/url]

Member Avatar for iamthesgt
0
363
Member Avatar for lochnessmonster

You can't allocate memory to the end of your array. You must allocate the new memory and then copy the existing array into the new memory and then finally delete the old memory.

Member Avatar for gerard4143
0
102
Member Avatar for mikecolistro

If the poster will search this section, he'll find a post that shows how to randomly fill an array with unique values...The post was recent(1 - 7 days ago).

Member Avatar for mikecolistro
0
154
Member Avatar for sketchiii

I didn't look over your code because its not enclosed within code tags. However have you considered that your program does not run continuously since its scheduled ran and rescheduled again.

Member Avatar for Adak
0
224
Member Avatar for lochnessmonster

In C++ you generally create the variables where they are used...In C its considered improper programming style to mixed declarations and code but C++ its O.K.

Member Avatar for spoonlicker
0
124
Member Avatar for sketchiii
Member Avatar for fg_aa_c

Line 26 [code] serv_addr.sin_addr.s_addr = INADDR_ANY; [/code] Should be [code] serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); [/code] If that fails then try a larger port number like 50000.

Member Avatar for fg_aa_c
0
1K
Member Avatar for toolbox03

[QUOTE=jephthah;606438]on the one hand i probably complain too much. on the other hand, after a long day at work, i find this coding style with no whitespace, no indentions, no syntax, no nothing, to be unreadable in the most annoying way. anyhow, sockaddr and sockaddr_in are two different structure types. …

Member Avatar for gerard4143
-1
136
Member Avatar for ram619

I just ran your code and your missing 3, 5, 7. I think this works...Never checked it with valid prime numbers. [code] #include<stdio.h> #define ARR_SIZE 100 int main() { int arr[ARR_SIZE], i, j = 1, left; for(i = 0;i < ARR_SIZE; ++i) { arr[i] = j++; } for(j = 2; …

Member Avatar for ram619
0
127
Member Avatar for elsiekins

Line 80 [code] linked_list_push_back(11, 99); [/code] Your passing the number eleven not your linked list pointer ll.

Member Avatar for elsiekins
0
301
Member Avatar for tom1252
Member Avatar for jacob21

First question. Do you want to display it reversed or do you what to reverse the order in the c string?

Member Avatar for gerard4143
0
113
Member Avatar for hariharan89

[QUOTE=hariharan89;1475608] I didnt understand, what will be stored in myargv? could any one tell me what will be the final value of argv? thanks in advance ..[/QUOTE] What's stored? A double pointer to char, would it make more sense written like this [code] char **myargv = &argv[1]; [/code] What's the …

Member Avatar for gerard4143
0
136
Member Avatar for tzmen23

Line 24 [code] *chptr='\0'; [/code] Is chptr pointing to valid memory?

Member Avatar for rajeevpareek
0
106
Member Avatar for ravi77

Firstly, your trying to concatenate onto a string that's immutable [code] str1="hello";/*creates a immutable c string*/ strcat(str1,s);/*Can't do this for two reasons, one - str1 isn't big enough and two str1 in immutable*/ [/code]

Member Avatar for gerard4143
0
126
Member Avatar for relient28

Its a good idea to initialize local variables but if the variables going to be assigned to right away then you can leave them uninitialized...Myself, I always initialize local variables. I like knowing that my program is in a valid state. One case that's essential is pointers. A pointer should …

Member Avatar for L7Sqr
0
130
Member Avatar for surferxo3

That's because the system stores the number as 1... 0001 and 1 are equivalent so if you need leading zeros, try storing the value as a string.

Member Avatar for surferxo3
0
126
Member Avatar for Mr.UNOwen
Member Avatar for Muhammadlodhi

You need to add an extra for loop like below. [code] #include <iostream> using namespace std; int main() { for (int i = 0; i < 5; ++i) { for (int j = i + 1; j > 0; --j) { cout << i + 1; } for (int j …

Member Avatar for Muhammadlodhi
0
109
Member Avatar for geekme

For small C projects I use Gedit or Vim anything larger and I would switch to C++ and Qt Creator or KDevelop.

Member Avatar for chrjs
0
96

The End.