Sollicitatievraag bij NVIDIA

Difference between const char * and char const *

Antwoorden op sollicitatievragen

Anoniem

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

Anoniem

5 apr 2012

There is no difference

2