NVIDIA Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
6
of 6 vote

const char pointer: const char *

The chars the pointer points to cannot be modified.

const pointer to char: char * const

The address the pointer points to cannot be modified.

- axa May 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
4
of 4 vote

Easy way to remember this, since it is somewhat confusing at times:

get the type near to the keyword const

1) const char *ptr ==> const char ==> the character value (to which this pointer points) is constant.
2) char * const ptr ===> const * ==> the pointer is constant and can point to only one memory when it was initialized.

- Dsk September 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
4
of 4 vote

Read right to left.

const char * p = "p is a pointer to char which is constant"
char * const p = "p is a constant pointer to a char"

- Anonymous August 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes, I always use this trick.

- akshaycj47 November 10, 2015 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

const char *p, char * const p
first is constant character pointer, the value pointed by p is constant.
second one is a constant pointer to character, where the value of p (address) is constant.

- Punit Jain May 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

const char *p = pointer to a constant char (need not be initialized)
char *const p = const pointer (pointer needs to be initialized but value pointed to can change)

- Anonymous May 23, 2012 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More