493 views

3 Answers

Best answer
1 votes
1 votes
C) a=p is not a valid statement.p=a is valid as we are assigning the address of a[0] to p. p=a+2 is valid assigning address of a[2] to p.

p=&a[2] is same as previous.
selected by
3 votes
3 votes

Answer : C 

This is not a valid assignment because "a" is not a variable here and there is no space allocated for "a" in the memory it is just a nemonic  .

edited by
0 votes
0 votes
base address of an array is constant .so we cannot increment,decrement its value....and cannot assign any value to it

if we assign we will get an error i.e "l value required"

so OPTION C IS NOT VALID.

Related questions

2.9k
views
1 answers
2 votes
Shubhanshu asked Jul 11, 2017
2,933 views
Consider the program:-void main(){ int a[] = {0, 1, 2, 3, 4}; int *p[] = { a, a+1, a+2, a+3, a+4 }; int ptr = p; ptr++; print( ptr - p, *ptr - p, ptr ); *ptr++; print( ...
863
views
1 answers
1 votes
srestha asked May 5, 2019
863 views
$1)$ How to access array element with array of pointers? By pointer to an array we can access like this $(*a)[0]$,$(*a)[22]$,….. like thisright?but how with array of po...
770
views
1 answers
0 votes
aditi19 asked Sep 13, 2018
770 views
what is wrong with this code? It shows segmentation fault#include<stdio.h>#include<stdlib.h>void main(){ int i,j,count=1; int a=(int )malloc(3*sizeof(int*)); fo...
602
views
1 answers
0 votes
shivam sharma 5 asked Aug 28, 2018
602 views
give the complete solution with explanationint main(){ int arr = {10,2,3,4,5,6,7,8}; int *p, *q; p = &arr ; q = (int*) arr; printf("%d ,%d \n",*p...