15.what is the disadvantage of using macros?
16.what is the self-referential structure?
17.can a union be self-referenced?
18.What is a pointer?
19.What is the Lvalue and Rvalue?
20.what is the difference between these initializations?
21.Char a[]=”string”;
22.Char *p=”literal”;
23.Does *p++ increment p, or what it points to?
Answer Posted / abdur rab
The difference between
21...in char a[]="string";
22... in char *p="literal";
is
in char a[]="string";, the memory is allocated, so the
value can be changed, it can be incremented, etc.
where as in char *p="literal";, you can just read it, may
be you can increment the pointer to point to the next
location, the content cannot be changed since this is a
string literal or BSS (Block Started by Symbol). This is
often called "const_data" or "data_const", or "literal".
23. *p++ it gets the content, and then increments the
pointer to the next location.
eg:
char a[] = {"string"};
char x;
char* p = (char*) a;
x = *p++;
printf ( "%c\n, %s\n", x, p );
output
======
s
tring
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Why doesnt this code work?
What is the purpose of sprintf() function?
What is the use of function overloading in C?
What is the advantage of an array over individual variables?
Which type of language is c?
Differentiate between ordinary variable and pointer in c.
What is the argument of a function in c?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
How do we declare variables in c?
What is array in C
What is static function in c?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
What is queue in c?
Which is the best website to learn c programming?
What is a spanning Tree?