Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Pointers, arrays, and string literals

A recently posted question on Stack Overflow highlighted a common misconception about the role of pointers and arrays held by many programmers learning C.The confusion stems from a misunderstanding concerning the role of pointers and strings in C. A pointer is an address in memory. It often points to an index in an array, such as in the function strtoupper in the following code:void strtoupper(char *str){ if (str) { // null ptr check, courtesy of Michael while (*str != '\0') { // destructively modify the contents at the current pointer location ...

2,777 0       CHAR POINTER INITIALIZATION LITERAL CANN