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 / vignesh1988i
15)
the disadvantage is... th macros will blindly substitute the
values which we have defined......
#define sr(s) s+s
main()
{
....
...
int c;
c=sr(10)/5;
}
can u guess what will be the output..... 12... but i want
4.... the macros wil get substitute like this before
compailation
c=s+s/5;
since '/' symbol gets the first prirority... thatr wil
happen first.... but we dont wann this.... so this is an
idiotic mode of substitution............. this is its dis
advantages.......
16...
this structure pointer which points to the same structure
whrer its declared is called self referencial structure
18...
pointer are secondary constants and are derived data types
whic can hold only the address of particular data type .. as
same as the pointer is declared..
int *p;
thid m eans that it can hold hold only the address of an
integer and points to that memory location.........
19...
Lvalue is called left assignment value..... Rvalue right
assignment value;;;
if you give: x+y=m; in C statement ... it will
show these types of errors
21...in char a[]="string";
hrer we are initilizing the array of characters to an
array called a..... and implicitely it will add '\0' at last...
22... in char *p="literal";
here p is an character pointer which can hold the
address of an character type of values....
hrer p hold the address of 'l'... this is called as base
address of the array..... when we maniplate the p value (ie)
when we do pointer arithmetic we can print and those the
full string...
23...
*p++
here * has the first precedence compared to ++ operator
therefore.. the pointer p , where it is pointing at present
that value will be incremented.......
for eg:
char q[]="sorry";
char *p;
p=&q[0];
*p++;
printf("%c",p);
now the pointer points to the very first
character of q[].. when we give *p++, *p will be 's' then
while getting incremented it will increment the ascii value
.... so the OUTPUT will be 't'...........
thank you
Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
Which programming language is best for getting job 2020?
When should the const modifier be used?
Can you please explain the difference between malloc() and calloc() function?
find the sum of two matrices and WAP for it.
which is conditional construct a) if statement b) switch statement c) while/for d) goto
Explain what is the difference between the expression '++a' and 'a++'?
What is null in c?
Here is a neat trick for checking whether two strings are equal
What are static variables in c?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
What is main function in c?
What are the uses of a pointer?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
What is the newline escape sequence?
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers