|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
C
DETAILS
Question: Difference between const char* p and char const* p
Answer: In const char* p, the character pointed by ‘p’ is constant, so u cant change the value of character pointed by p but u can make ‘p’ refer to some other location.
in char const* p, the ptr ‘p’ is constant not the character referenced by it, so u cant make ‘p’ to reference to any other location but u can change the value of the char pointed by ‘p’.
|
|
|
Category |
C Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8400 users |
Added on |
9/18/2014 |
Views |
66840 |
Rate it! |
|
|
Question:
Difference between const char* p and char const* p
Answer:
In const char* p, the character pointed by ‘p’ is constant, so u cant change the value of character pointed by p but u can make ‘p’ refer to some other location.
in char const* p, the ptr ‘p’ is constant not the character referenced by it, so u cant make ‘p’ to reference to any other location but u can change the value of the char pointed by ‘p’. Source: CoolInterview.com
const char*p -> p is a pointer to constant character. In this case we cant change the value of the pointer pointing to. But pointer can be made to point to some other location
char const*p -> constant pointer to char. Here pointer cant be moved to point to new location. Where as the value it points to can be changed Source: CoolInterview.com
Answered by: srdhr76 | Date: 9/21/2009
| Contact srdhr76
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
Can you tell me how to check whether a linked list is circular ?
|
View Answer
|
|
How to reduce a final size of executable ?
|
View Answer
|
|
How to reduce a final size of executable ?
|
View Answer
|
|
What is the output of printf("%d") ?
|
View Answer
|
|
What is hashing ?
|
View Answer
|
|
#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }
|
View Answer
|
|
main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }
|
} - C Interview Questions & Answers">
View Answer
|
|
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }
|
} - C Interview Questions & Answers">
View Answer
|
|
void main() { int const * p=5; printf("%d",++(*p)); }
|
} - C Interview Questions & Answers">
View Answer
|
|
Can we have nested header files in C?
|
View Answer
|
|
What is the difference between object and reference?
|
View Answer
|
|
How to write a 'C' program to read an array of 10 numbers and print the prime nums?
this is what i wrote could someone tell me where is my mistake? can i use here flag at all?
#include <stdio.h>
void main () { int arr[10], i, j, flag;
for (i=0;i<10;i++)
scanf ("%d", &arr[i]);
for (i=0;i<10;i++) { flag=1;
for (j=2;j<=(arr[i]/2); j++) { if (arr[i]%j==0) { flag=0; break;
} } }
for (i=0;i<10;i++) { if (flag=1)
printf ("%d", arr[i]); }
|
View Answer
|
|
Which language is not high-level language?
|
View Answer
|
|
What is data independence? what is transaction process application? Discuss the main charecteristics of data approach how it differs from traditional file system!
|
View Answer
|
|
How to find size of an datatype without using sizeof operator?
|
View Answer
|
|
How to find GCD of four numbers?
|
View Answer
|
|
Write a program to accept any number up to six digit and print in words. for ex:1234=one two three four
|
View Answer
|
|
What is type integration? And what is integer type integration?
|
View Answer
|
|
What is :- Token , identifier , block , parameter , argument , scope of variable , Macro ?
|
View Answer
|
|
What is the code to find our age,for example if my date of birth is 4/12/1986 and today date is 16/11/2008 answer should give our year,month,no of days
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All C Interview Questions & Answers - Exam Mode /
Learning Mode
|