1. const char *a;
2. char* const a;
3. char const *a;
-Differentiate the above declarations.
Answers were Sorted based on User's Feedback
Answer / manoj ku. dalai
Explaining With the examples.........
1) const char *a="xyz" (string is constant, pointer is not)
*a='x' (error)
a="hi" (legal)
2) char* const a="xyz" (pointer is constant, String is not)
*a='x' (legal)
a="hi" (error)
3) char const *a="xz" (string is constant, pointer is not)
a*='x' (error)
a="hi" (legal)
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / susie
Answer :
1. 'const' applies to char * rather than 'a' ( pointer to a
constant char )
*a='F' : illegal
a="Hi" : legal
2. 'const' applies to 'a' rather than to the value of
a (constant pointer to char )
*a='F' : legal
a="Hi" : illegal
3. Same as 1.
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / srinivas
The answers for first and third case is fine,but in 2nd
case we cannot assign *a='F',becoz *a points to starting
address of the array you cannot change the value at that
address where the reference to that pointer is lost.
Is This Answer Correct ? | 0 Yes | 1 No |
source code for delete data in array for c
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }
Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list)
3 Answers Disney, Google, ZS Associates,
int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4
main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }