Try the below programs and analyse the output.
A)
int main()
{
int n = 5;
int j;
j = ++n++;
printf("j = %d\n", j);
return 0;
}
o/p = ?
B)
int main()
{
int n = 5;
int *p = &n;
int j;
j = ++*p++;
printf("j = %d\n", j);
return 0;
}
o/p = ?
C)
int main()
{
int n = 5;
int *p = &n;
int j;
j = ++(*p)++;
printf("j = %d\n", j);
return 0;
}
o/p = ?
PS: First of all, U need to know operator precedence and associativity to understand the program.
15 July, 2011
14 July, 2011
String Palindrome - Recursive function
Hi all,
Write a program to find whether the given string is palindrome or not with the help of recursive functions.
NOTE: There are many ppl who are not active in this forum, i request them to wake up and reply to the questions posted or atleast to post some questions. Else those ppl will be removed from this forum.
Write a program to find whether the given string is palindrome or not with the help of recursive functions.
NOTE: There are many ppl who are not active in this forum, i request them to wake up and reply to the questions posted or atleast to post some questions. Else those ppl will be removed from this forum.
07 July, 2011
Ternary Operator
main()
{
int a = 10, b = 7;
a >= 5 ? b = 100 : b = 200;
printf("B = %d\n",b);
}
When we compile this prg, I am getting an error like this:
3: error: lvalue required as left operand of assignment
What does this mean and how to resolve it?
{
int a = 10, b = 7;
a >= 5 ? b = 100 : b = 200;
printf("B = %d\n",b);
}
When we compile this prg, I am getting an error like this:
3: error: lvalue required as left operand of assignment
What does this mean and how to resolve it?
Subscribe to:
Comments (Atom)