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


Please Help Members By Posting Answers For Below Questions

Why doesnt this code work?

618


What is the purpose of sprintf() function?

603


What is the use of function overloading in C?

679


What is the advantage of an array over individual variables?

744


Which type of language is c?

653






Differentiate between ordinary variable and pointer in c.

618


What is the argument of a function in c?

575


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

941


How do we declare variables in c?

571


What is array in C

710


What is static function in c?

635


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

616


What is queue in c?

578


Which is the best website to learn c programming?

582


What is a spanning Tree?

954