|
|
Up |
|
|
  |
|
|
  |
Author: mdhmdh
Date: May 5, 2008 19:52
One thing has puzzled me a while ( well, more than one thing!).
If I have a function:
foo( char *s){
char *t = s;
.....
s++; <<--- a few arbitrary times
}
Now...my question is this.
Is "t" independent of s, in the sense of:
1) Will it still point to the beginning of s, after s++ ?
2) I guess related to 1, if I now evaluate *t, will it be the first
character in s?
Thanks...that's it for today!!!
|
| |
|
| |
17 Comments |
|
  |
Author: Bryan ParkoffBryan Parkoff
Date: May 5, 2008 19:50
I want to know how much static memory is limited before execution
program starts. I would write a large array. The large array has 65,536
elements. The data size is double word. The static memory would allocate
256K. The 256K is a fixed memory size. After the compiler has completed
compiling header and source code, the execution program might fail to run or
crash. The operating system might do not display error message saying,
"Insufficient memory."
The dynamic memory may be the option. The malloc() function can test to
determine if allocated memory is available at run-time. Then, use I/O like
fopen() and fclose() functions to read data from the hard drive and store it
into RAM. The error message can display at run-time if malloc() tests to
tell insufficient memory...
|
| Show full article (0.94Kb) |
|
11 Comments |
|
  |
Author: Renato PeriniRenato Perini
Date: May 5, 2008 16:08
Hi all!!!
I'm trying to find a *good* book about OpenMP and C, but I can't find
anything specific. Can you advice me some good (and updated) books about
OpenMP using the C interface? I'd like a book that covers everything
from the ground up. Thank you in advance.
|
| |
|
6 Comments |
|
  |
Author: RazRaz
Date: May 5, 2008 15:24
On Wed, 30 Apr 2008 21:54:37 GMT, Erik Wikströ
>Obviously his knowledge of C++ is not as good as it should be.
|
| |
|
24 Comments |
|
  |
Author: GaryGary
Date: May 5, 2008 15:04
When you declare an array of chars and store a string in it, where is
the position of the null character \0? And what happens to the unused
memory locations?
#include
int main(void)
{
char gstring2[25] = "dudes";
gstring2[5] = 'a';
printf("%%s \n", gstring2);
return 0;
}
The output of main function was
dudesa
How come this code works, and the statement
gstring2[5] = 'a';
doesn't overwrite the null character?
|
| |
|
8 Comments |
|
  |
Author: Sam JosephSam Joseph
Date: May 5, 2008 14:14
Hello,
I need to mount a loopback file system. I'm using SYS_mount, but it
always fails with ENOTDIR. Am I doing something silly? Here's the
offending line:
if(syscall(SYS_mount,
"/home/sam/mnt/", "/home/sam/myfile.img", "-o loop" ))
perror("Mount failure/ ");
Thanks.
|
| |
|
28 Comments |
|
  |
Author: mdhmdh
Date: May 5, 2008 11:19
I have a question about the library function strcpy.
In K&R on page 109, strcpy is used to copy a line ( line[] ) to a
pointer (char *), which is first allocated space by K&Rs "alloc"
function.
In a few pages prior to this, the example that K&R showed used this
definition for it's version of strcpy
void strcpy( char *s, char *t){
while ( *s++ = *t++);
}
Could someone help me understand the library function, which,
according to the appendix, returns the target string.
So, in this case, what is passed to the library is an array-the
original string and a pointer to the target string? What happens if
the target pointer has not been allocated space? And, is this
acceptable ie to pass a pointer instead of an actual char array for
the target string?
tks
|
| |
|
16 Comments |
|
  |
Author: Benoit LefebvreBenoit Lefebvre
Date: May 5, 2008 08:54
Weird subject you will say.. I didn't know what to put in there..
Long story short, I'm changing the value of a variable from a
function.. Nothing unusual there..
How come the value of the "word" variable change when using the
testfunct function? Am I sending a pointer to the word variable to
this function or whatever ??
I know it's a weird question.. especially that this is doing exactly
what I need.. but I want to know if I'm doing it right and if not, how
to make it work correctly.
The program where this is going is checking a configuration text file
and puts all the lines in a 2d char array for comparison later. Here
is a simplified "extraction" of the code.
------
#include
#include
int testfunct (char *myword)
{
strcpy(myword,"hello");
|
| Show full article (0.99Kb) |
|
4 Comments |
|
  |
|
|
  |
Author: glow4glow4
Date: May 5, 2008 06:26
We’re a video game specialist and wholesaler for modded consoles,
retro consoles and game backups, we ship worldwide. Below are some of
our offerings at wholesale prices. For any enquiries, please feel free
to contact us at gamersparadisemy@ gmail.com
Sony Playstation 3 - 40GB Pack (NTSC/U & NTSC/J versions available)
comes with two dual shock 3 controllers and Hori cooling fan.
USD 350 (with worldwide shipping)
XBOX 360 Elite (with HDMI)
– 120GB Pack (NTSC/U & NTSC/J) comes with two controllers and Nyko
cooling fan.
Modded and able to run XBOX 360 backups, homebrew softwares and able
to go online via XBOX Live.
USD 400 (with worldwide shipping)
|
| Show full article (3.13Kb) |
|
no comments
|
|
|
|
|
|
|