Search Results

Showing results 1 to 40 of 44
Search took 0.01 seconds.
Search: Posts Made By: Stack Overflow ; Forum: C and child forums
Forum: C May 3rd, 2008
Replies: 0
Views: 470
Posted By Stack Overflow
Hello,

I am trying to determine the best possible solution to accomplish a simple, yet complex task. (Regarding: Socket Programming)

I've been working on a new project for quite some time and...
Forum: C Mar 10th, 2005
Replies: 13
Views: 4,249
Posted By Stack Overflow
Hello,

You're welcome. If you have any further questions regarding the information I provided, don't hesitate to ask.


- Stack Overflow
Forum: C Mar 10th, 2005
Replies: 13
Views: 4,249
Posted By Stack Overflow
Hello,

Keep in mind if the space cannot be allocated, a null pointer is returned. If you try to write to the NULL block of memory, it will cause a segmentation fault. It's best to test for NULL...
Forum: C Mar 10th, 2005
Replies: 13
Views: 4,249
Posted By Stack Overflow
Hello,

In addition, you may find this short tutorial on Segmentation Faults handy: Locating a Segmentation Fault (http://cboard.cprogramming.com/showthread.php?t=59721#post421421)

Or if you...
Forum: C Mar 10th, 2005
Replies: 13
Views: 4,249
Posted By Stack Overflow
Hello,

Indeed it should. Each call to malloc will be subsequently freed during each loop iteration.

I'm not entirely sure. I don't have any hard evidence or facts at the moment, though I have...
Forum: C Mar 10th, 2005
Replies: 13
Views: 4,249
Posted By Stack Overflow
Hello,


If I am correct in my thinking, you will have lost allocated memory in your program. Your pointer, q, is a variable. Allocating memory to it 1000 times will cause a problem.

According...
Forum: C Mar 9th, 2005
Replies: 18
Views: 6,276
Posted By Stack Overflow
Hello,

1) What I mean't by function scope is simple. All it knows is what is happening within the function, and it doesn't have a clue as to what is happening in the 'int main' part of the...
Forum: C Mar 9th, 2005
Replies: 18
Views: 6,276
Posted By Stack Overflow
Hello,

No problem. Let me answer this question by example:#include <stdio.h>
#include <stdlib.h>

void test(char **p) {
/* run test; view memory address */
printf("Function scope:...
Forum: C Mar 9th, 2005
Replies: 18
Views: 6,276
Posted By Stack Overflow
Hello,

When you call free, the memory pointed to by the passed pointer is freed, but the value of the pointer in the caller remains unchanged, because C's pass-by-value semantics mean that called...
Forum: C Mar 9th, 2005
Replies: 18
Views: 6,276
Posted By Stack Overflow
Hello,

Also, be sure to set your variable to NULL after you free the memory. Example:free(G); /* Dynamically allocated memory is freed */
G = NULL; /* This ensures that we point our pointer to...
Forum: C Mar 9th, 2005
Replies: 18
Views: 6,276
Posted By Stack Overflow
Hello,

When free() is called, a block of memory previously allocated by a call to malloc, calloc or realloc is freed:Graph G=malloc(sizeof *G); /* Memory is dynamically allocated */
if (G !=...
Forum: C Feb 23rd, 2005
Replies: 3
Views: 5,873
Posted By Stack Overflow
Hello,

The switch statement is a multi-way decision that tests whether an expression matches one of a number of constant integer values, and branches accordingly. The break statment causes an...
Forum: C Feb 21st, 2005
Replies: 3
Views: 1,853
Posted By Stack Overflow
Hello,

This is quite simple in fact. We will run one loop through 8 times for simplicity. Each loop around we will increase a single variable that will tell us where to stop. Here is our...
Forum: C Nov 2nd, 2004
Replies: 49
Views: 18,802
Posted By Stack Overflow
Ah,

This makes sense. What is happening is that you find a duplicate and then flag it. What if there are 2 of the same ones? The program can't deal with it unless you remove them right when you...
Forum: C Nov 2nd, 2004
Replies: 49
Views: 18,802
Posted By Stack Overflow
Well,

There was a small error with one of your if statements:if (flag=1)That will cause flag to always equal 1 instead of checking if flag is 1. The way we do that is to use the == operator. That...
Forum: C Nov 2nd, 2004
Replies: 6
Views: 1,981
Posted By Stack Overflow
Greetings,

There are a few issues with the program. Nothing major though.

Firstly, frrossk showed the first issue. The new line should only take place after the first loop is continuing, not...
Forum: C Nov 2nd, 2004
Replies: 49
Views: 18,802
Posted By Stack Overflow
Well,

Here is the problem right here:printf("ENTER ARRAY ELEMENTS:");
scanf("%d",&a[i]);
fflush(stdin);So far you call scanf() onces only. Ask for one integer and send it to a[i]. So far i is...
Forum: C Nov 2nd, 2004
Replies: 2
Views: 2,004
Posted By Stack Overflow
Greetings,

const keyword
Variables declared with ‘const’ become constants and cannot be altered by the program.

static keyword
The most commonly used and understood purpose of the
'static'...
Forum: C Nov 1st, 2004
Replies: 5
Views: 2,309
Posted By Stack Overflow
Alright,

Here are the changes:#include <iostream>
#include <stdio.h>
using namespace std;

void getData(int *, int *, int *);

int main() {
int month;
Forum: C Nov 1st, 2004
Replies: 5
Views: 2,309
Posted By Stack Overflow
Greetings phr0stbyt3,

Getting the data is not difficult at all. We can either use scanf() or fgets().

scanf()
int scanf(const char *format [, argument, ...]);
> Reads data from the standard...
Forum: C Oct 19th, 2004
Replies: 1
Views: 4,701
Posted By Stack Overflow
Greetings,

Pointers are facile, yet confusing. Thinking in the programming world isn’t easy, and comprehending everything read, intricate. This tutorial leads from the previous, which may clarify...
Forum: C Oct 14th, 2004
Replies: 17
Views: 4,556
Posted By Stack Overflow
Alright,

Seems understandable. A priority queues is a container adaptor which allows use of any sequential container with a random access iterator to maintain a sorted collection of items. You can...
Forum: C Oct 14th, 2004
Replies: 17
Views: 4,556
Posted By Stack Overflow
Greetings,

As you may want to sort the last number calculation try the following code in your compareProducts() function:return ( ( (rec1->num1/1000) + (rec1->num2 - rec1->num3) ) - (...
Forum: C Oct 14th, 2004
Replies: 17
Views: 4,556
Posted By Stack Overflow
Greetings,

I just noticed that your comparing command compareProducts() has a slight issue. Since we can only sort one number at a time, usually, we will have to resort to checking if the two...
Forum: C Oct 14th, 2004
Replies: 17
Views: 4,556
Posted By Stack Overflow
I agree with Narue. It may help if you search for bubble sorting. It's a famous algorithm for sorting all types of data.


- Stack Overflow
Forum: C Oct 14th, 2004
Replies: 17
Views: 4,556
Posted By Stack Overflow
Greetings,

If I understand correctly, you want to find which of the totals are shortest. Like from minimum to maximum, e.g. A is less than B so B is greater; B is greater than C so C is less than...
Forum: C Oct 14th, 2004
Replies: 3
Views: 1,688
Posted By Stack Overflow
Greetings HollywoodTimms,

Good to see you have a head-start on this. It dawned on me that I was un-aware of what you were asking specifically. I did realise you are trying to calculate A/1000 + B...
Forum: C Oct 5th, 2004
Replies: 5
Views: 2,731
Posted By Stack Overflow
Greetings,

Well, you're right on. Finding the divisor of a positive number can be easily found using the modulus operator, %. The modulus operator works on integers (and integer expressions) and...
Forum: C Oct 5th, 2004
Replies: 0
Code Snippet: Linux: gotoxy()
Views: 17,954
Posted By Stack Overflow
I've heard the curses library can be useful when trying to implement the handy DOS-only tools of gotoxy() and clrscr() using move() and initscr(). Though, there is a way to write your own gotoxy() in...
Forum: C Sep 28th, 2004
Replies: 2
Views: 2,003
Posted By Stack Overflow
Greetings ray96,

Mathematics in C is not difficult to use. For example, lets take this word problem for example:

Note: Since 360° = 2 radians, then 180° = radians.
We will use this fact to...
Forum: C Sep 27th, 2004
Replies: 2
Views: 75,801
Posted By Stack Overflow
Greetings,

Using a 2-Dimensional array isn't very difficult at all. In fact for simplicity, lets take a look how a 2-Dimensional array looks in all aspects.

int myValue[2][3];

We know this...
Forum: C Sep 24th, 2004
Replies: 11
Views: 8,193
Posted By Stack Overflow
Check out http://www.asciitable.com/

The full list of ASCII characters are there. The function isprint() knows which of the characters are printable. isprint() returns a nonzero value if the input...
Forum: C Sep 23rd, 2004
Replies: 9
Views: 4,320
Posted By Stack Overflow
Greetings,

Binary operations can be somewhat confusing at times, though quite simple to understand. It is customary to refer to a digit in binary (either 1 or 0) as a bit, likewise a byte is a set...
Forum: C Sep 22nd, 2004
Replies: 1
Views: 1,249
Posted By Stack Overflow
No problem. We are all glad to be of help and assistance.

- Stack Overflow
Forum: C Sep 20th, 2004
Replies: 1
Views: 9,610
Posted By Stack Overflow
Greetings,

String parsing isn't always an easy task. Especially in cases where you need to split a single string into a great multitude, but also accounting for maximum performance.

The...
Forum: C Sep 19th, 2004
Replies: 4
Views: 2,793
Posted By Stack Overflow
Greeting XianBin,

Pointers can be somewhat confusing, but let's see if we can go through this code one step at a time. It may help the understanding of how it works, and how useful these...
Forum: C Sep 18th, 2004
Replies: 13
Views: 360,265
Posted By Stack Overflow
» Neither does itoa.
Exactly, though now there is a working prototype. It wouldn't be hard for someone to modify it and make it safer. It is alot better off than re-writing sprintf().

» It is...
Forum: C Sep 18th, 2004
Replies: 13
Views: 360,265
Posted By Stack Overflow
Ah, yes. Though remember sprintf() does not calculate for buffer overflow. sprintf() doesn't flush any file buffer, in fact it doesn't have any buffer associated with it. sprintf() operates on a...
Forum: C Sep 18th, 2004
Replies: 13
Views: 360,265
Posted By Stack Overflow
Greetings,

This process is not hard since the default libraries included a function to do this. It's called itoa().

» char *itoa(int value, char *buffer, int radix);
Converts an integer value...
Forum: C Sep 17th, 2004
Replies: 2
Views: 6,177
Posted By Stack Overflow
Greetings Mahen,

I have some useful links I believe might interest you.

· How to create a DLL (http://www.icynorth.com/development/createdlltutorial.html)
· DLL Reference Page...
Showing results 1 to 40 of 44

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC