This is probably very simple, but I can't get it to work.
I have this very simple piece of code:
#include <stdio.h> #include <string.h> int main(void) { char buf[100]; char *p = buf; strcpy(p, "Test string"); printf("%s\n", *p); }
This causes a segmentation error when it starts. GDB Outputs:
Program received signal SIGSEGV, Segmentation fault. 0xb76af3b3 in strlen () from /lib/i686/cmov/libc.so.6
But I still do not understand.
Comments will be appreciated, thanks.
Hamza source share