NVIDIA interview question

Difference between const char * and char const *

Interview Answers

Anonymous

8 Jun 2012

There are 3 DIFFERENT ways to use const (Under the context of the question) int main(int argc,void* argv[]) { /*Can't change the string value "abc"*/ const char* str1 = "abc"; /*Can't change the pointer address to "def"*/ char* const str2 = "def"; /*Can't change both the pointer address and the string value to "ghi"*/ const char* const str3 = "ghi"; return 0; }

10

Anonymous

5 Apr 2012

There is no difference

2