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
How can you read a directory in a C program?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Write program to remove duplicate in an array?
What is pass by value in c?
What are the different categories of functions in c?
Give differences between - new and malloc() , delete and free() ?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
Write a program to print ASCII code for a given digit.
Where is c used?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
how to construct a simulator keeping the logical boolean gates in c
Explain the properties of union.
What is indirection in c?
Can main () be called recursively?