title: Extracting the first two words in a sentence in C without pointers
body: <p>I am getting used to writing eBPF code as of now and want to avoid using pointers in my BPF text due to how difficult it is to get a correct output out of it. Using strtok() seems to be out of the question due to all of the example codes requiring pointers. I also want to expand it to CSV files in the future since this is a means of practice for me. I was able to find another user's code here but it gives me an error with the BCC terminal due to the one pointer.</p>
  <pre><code>char str[256];
  bpf_probe_read_user(&amp;str, sizeof(str), (void *)PT_REGS_RC(ctx));
  char token[] = strtok(str, &quot;,&quot;);
  
  char input[] =&quot;first second third forth&quot;;
  char delimiter[] = &quot; &quot;;
  char firstWord, *secondWord, *remainder, *context;
  
  int inputLength = strlen(input);
  char *inputCopy = (char*) calloc(inputLength + 1, sizeof(char));
  strncpy(inputCopy, input, inputLength);
  
  str = strtok_r (inputCopy, delimiter, &amp;context);
  secondWord = strtok_r (NULL, delimiter, &amp;context);
  remainder = context;
  
  getchar();
  free(inputCopy);
  </code></pre>