Monday, 11 November 2019

Arrays, Addresses and Pointers in C Programming

What's the difference between this:

char s[] = "Hello";

and this...?

char *s = "Hello";

Aren't they just two ways of doing the same thing? That is, of assigning the string "Hello" to the string variable s? Well, no. In fact, these two assignments are very different things. If you have moved to C from another language such as Java, Python, C# or Ruby, making sense of arrays, strings, pointers and addresses is likely to be one of the biggest challenges you'll face. Here's a video I made that should help out.



For a more in depth guide to C programming, see my book, The Little Book Of C:
Amazon (US): https://amzn.to/2RXwA6a
Amazon (UK): https://amzn.to/2JhlwOA

For a full explanation of pointers, see The Little Book Of Pointers:
Amazon (US): https://amzn.to/2LF2aVb
Amazon (UK): https://amzn.to/2FViSvS