Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

how to set a pointer to an offset in c

char *ptr0 = "Hello Goodbye";
char *ptr1 = ptr0+6; // offset 6 bytes from ptr0
printf("ptr0: %s
", ptr0); // expected output ptr0: Hello Goodbye
printf("ptr1: %s", ptr1);   // expected output: ptr1: Goodbye
 
PREVIOUS NEXT
Tagged: #set #pointer #offset
ADD COMMENT
Topic
Name
3+7 =