The difference here is that
will place Hello world in the read-only parts of the memory and making s a pointer to that, making any writing operation on this memory illegal. While doing:
puts the literal string in read-only memory and copies the string to newly allocated memory on the stack. Thus making
legal.
|
Tuesday, 30 June 2015
string vs char pointer
Monday, 29 June 2015
c program
compiler like gcc look for header files with brackets <> in standard paths like:
/user/include
/user/local/include
for other header files(#include"current.h") it look for in the current directory first & after that in standard path
Subscribe to:
Comments (Atom)