Answers for "pointer offset in c"

C
2

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\n", ptr0); // expected output ptr0: Hello Goodbye
printf("ptr1: %s", ptr1);   // expected output: ptr1: Goodbye
Posted by: Guest on February-27-2021

Code answers related to "C"

Browse Popular Code Answers by Language