Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential memory corruption with 14_functions/15_passing-by-value/04_string-pointer/main.go #21

Open
arsanjea opened this issue Jan 16, 2017 · 0 comments

Comments

@arsanjea
Copy link

arsanjea commented Jan 16, 2017

Todd,
In the changeMe function of 04_string-pointer/main.go, you seem to be using the memory allocation for a string of 4 characters ("Todd") to store a string of 5 characters ("Rocky").
Wouldn't the changeMe function be causing memory corruption issues?
Thanks!

fmt.Println(z) // 0x82023c080 fmt.Println(*z) // Todd *z = "Rocky" fmt.Println(z) // 0x82023c080 fmt.Println(*z) // Rocky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant