Code:
int *x = NULL; // * used such that x is a pointer.
makes sense
Code:
int a = *b; // * used such that *b is an int.
Aha this makes a containing the hexcode of the first field of b[]:
Code:
char *b="test";
int a;
a = *b;
printf("%i",a) ;
Prints: 116 so is it that char *b="test" tells push test on the stack and make b a pointer to it. While *b points to the content which start with 116, b and &b are just the memory adresses ?
Originally Posted by
laserlight
How did you use it?
In this code:
Code:
#include </usr/include/linux/unistd.h>
int main(void) {
char *myfile = "testfile",buffer[100];
int fd,buffer_len;
fd = syscall(__NR_open,myfile,00,04000) ;
syscall(__NR_read,fd,buffer,100);
syscall(__NR_close,fd);
for ( buffer_len=1; buffer[buffer_len] != '\0'; buffer_len++);
syscall(__NR_write,1,*buffer,buffer_len);
return 0;
}
I don't get any errors for *buffer. Normally compiled with gcc -o test test.c and gcc version 4.1.2 . The program simply doesn't work but compiles nice. *buffer exchanged with buffer or &buffer and the program works fine.