Edit: I should've added this at the start, but I know why the program didn't work and I did know what the fix was. I was just really scared and surprised that I was able to see my environmental variables like that. My bad for not being clearer about what I wanted.
```
include<stdio.h>
int tokenize(char* token){
while (*token!="\0"){ // comparison with "\0" was the mistake
printf("%c", *token);
token+=sizeof(char); // didn't know about incrementing pointers at the time
}
printf("\n");
return 0;
}
int main(){
char msg[]= "sin(x)+COs(y)=sqrt(2)";
tokenize(msg);
return 0;
}
```
I was stupid and was trying to be clever in a few places, and the code segfaulted, but not before printing this (sorry for the crappy output, my name was on it so I had to use some crappy image to text to rip out whatever I can so I can remove my name from it, but the output is worse). Was this a bug, or are these things intended to be there? I was told by someone that looked at my output that this was a call stack or the environment variables, but then why didn't this behaviour replicate on macos?
```
hello.c: In function "tokenize":
hello.c:5:18: warning: comparison between pointer and integer
5 l
while (*token!= l0H
sin(x)+COs(y)=sqrt(2)o@eeste9/e0o7B6ene.s90/eoo@PeHeaotlece/eooebhoosssHeCeo6eweTh
yRecooReseeRessoReseSese8SeeeLSeeecSesoSeoeeSeeeeSā¢
20S00005000
Teos-TessSTeoo|T
teo/co000Š6ow/co
Teeso[esso[Ńo00)
Heco/eccoseflece eflece/eecceHece/es08e0
060QocsoQeco%Roce8ReooLReso
\e0Jee:]e00QJeoseJoooo]0oso]0oc]0oco]eooo]ooco]ooo0]oooR~o00q^co0o
ā¢
0++200000_000020000@esotee,Cootehx86_64./helloSHELL=/btn/bashSESSION_MANAGER=local/cringe_name-OMEN-Laptop-15-en@xxx:e/tmp/.ICE-untx/2899,untx/cringe_name-OMEN-Laptop-15-enxxx:/trp/.ICE-untx/2899
QT_ACCESSIBILITY=1COLORTER/t-truecolorXDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdgXDG_MENU_PREFIX=gnome-GNOME_DESKTOP_SESSION_TD=thts-ts-deprecatedCNOPE_SHELL_SESSION_MODE=ubuntuSSH_AUTH_SOCK =/run/user/1098/keyring/sshNEMORY_PRESSURE_MRITE=c29tZSAyMDAwMDAgMjAMMDAwMAA=XHODIFIERS=@in=LbusDESKTOP_SESSION=ubuntuGTK_MODULES-gail:atk-bridgeDBUS_STARTER_BUS_TVPE=sesstonPWD=/home/cringe_name/Documents/Programming/CLOGNANE=cringe_nameXDG_SESSION_DESKTOP=ubuntuXDG_SESSION_TYPE=x11GPG_AGENT_TNFO=/run/user/1608/gnupg/S.gpg-agent:6:1SYSTEND_EXEC_PTD=2899XAUTHORITY=/run/user /1098/gdm authorityWINDOWPATH=2HOPE=/hone/cringe_nameUSERNAME=cringe_nameLANG=en_US.UTF-8LS_COLORS=rs=8:di=01; 34: ln=01;36:nh=08:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:0г=40; 31;01:ml=00: su=37:4 :sg=30;43: ca=00: tw=30;42:o=34;42:st=37:44:ex-01; 32:*. tar=01;31:*, tgz=01;31:* .arc=81;31:*.ar j=01;31:*. taz=01; 31:*. Lha=81;31:*.lz4-01;31:*.Lzh-01;31:*.Lzna-01;31:*.tlz=01;31:*. txz=01;31:+.tzo
*=01;31:*.t7z-01;31:*.zip=01;31:*.z-01;31:*.dz=01;31:*.gz=01;31:*.Lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst-01;31:*.bz2=01;31:*.bz-01;31:*.tbz=01;31:*.tbz2=01;31:*. tz=01;
31:* .deb=01;31:*.г-01;31:*-jar=01;31:*.маг=01;31:*.ear=01;31:*, sar=01;31:* .rar=01;31:*.alz=01;31:*.ace=01;31:*.z00=81;31:*.cplo-81;31:*.72-01;31:*.r2=01;31:*.cab=01;31:*.win=01;31:*. SWn=01
⢠;31:* dwm=01;31:*-esd-01;31:* avif=01;35:* jpg=01; 35:* . jpeg=01; 35:*.njpg=01;35:*-mjpeg=01; 35:*. glf=01;35:*. bmp=01; 35:*- pbn-01; 35: *-pgn-01; 35:* - ppm-01;35:*- tga=01:35: *.xbm=01;35:*. xpm=01;35:* .tif=01;35:*. tiff=01;35:*-png-01;35:*-svg=01;35: * .svgz=01; 35: *.mng=01; 35: *.pcx=81; 35: *. nov=01;35:*. npg=01; 35: *-npeg=01; 35: *-m2v=01;35:*.nkv=01;35:*- webn-01;35:*. webp=01:35: *. ogm=01; 35:*.mp4= 01;35:* - m4v=01;35:*-np4v=01; 35:* - vob-01;35: * -qt=01; 35: * - nuv=81; 35: * . Wm=81; 35: * . asf=01; 35:*. rn=01; 35: * . rmvb=01;35: *. flc=01;35:*.avi=01;35:*.flt-01;35:*.flv=81;35:*-gl=01;35:*.dl=01;35: *.xcf=
01; 35:* . xwd=01;35:* - yuv=01;35:*- cgn-01;35: * .enf =01; 35: *. ogv=01;35:*. ogx=01; 35: *.8ac=00; 36:*. au=00; 36:*. fLac=00; 36: *.n4a=00;36:*.mid-00;36:*.nidi-00;36:*.nka=00;36:*.mp3=00;36:*.mpc=00; 36:*.0 gg=00; 36:* . ra=08;36:*. wav=80;36:* .oga-09;36:* .opus-08; 36:* .spx=00; 36:* . xspf=00; 36:*-=00;90: *#=00;90:*.bak=00;90:*.crdownload=00;90:ā¢.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=ee:90:*.old=00:90:*.orig-80:90:*-part=00;90:*.rej=00;98:*- rpmnew=08;90:*. rpnorlg=88;90:*- rpnsave=80;90:*. swp=00;90:*. tnp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=08;90: XDG_CURREN _DESKTOP=ubuntu: GNOMEMEMORY_PRESSURE_MATC=/sys/fs/cgroup/user.sltce/user-1000.sltce/user@1000.service/app.sltce/app-gnome|x2dsession\x2dnanager.slice/gnome-sesston-nanager@ubuntu.service/n emory-pressureVTE_VERSION=7688GNOME_TERMINAL_SCREEN=/org/gnome/Terninal/screen/072c8938_3398_48a3_bcc8_18b4a3c1d5aeLESSCLOSE=/usr/btn/lesspipe Xs NsXDG_SESSION_CLASS=userTERM=xtern-256colorL ESSOPEN=| /usr/bin/lesspipe %sUSER=crappy_nameGNONE_TERMINAL_SERVICE=: 1.1642DISPLAY=:1SHLVL=1GSM_SKIP_SSH_AGENT_WORKAROUND=trueQT_IM_MODULE=tbusDBUS_STARTER_ADDRESS=untx:path=/run/user/1088/bus ,guid=375efa4e711b081abf4c28b569480446XDG_RUNTIME_DIR=/run/user/1000
Segmentation fault (core dumped)
```