Search Results

Showing results 1 to 10 of 10
Search took 0.00 seconds.
Search: Posts Made By: Stack Overflow ; Forum: C and child forums
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,278
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,278
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,278
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,278
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,278
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 !=...
Showing results 1 to 10 of 10

 


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

©2003 - 2009 DaniWeb® LLC