@dipankar +1
--
Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
On Fri, Aug 12, 2011 at 9:31 AM, Dipankar Patro dip10c...@gmail.com wrote:
The question is full of errors.
Provide the link, if you have copied it from somewhere.
On 11 August 2011 23:53,
What will be the output of the following program
#include
int main()
{
int m=10,p;
p=incre(incre (incre (++) incre) incre)
Printf(%d, *P);
return 0;
}
incre (int m)
{
m+=2;
return(m-2);
}
how?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
The question is full of errors.
Provide the link, if you have copied it from somewhere.
On 11 August 2011 23:53, Mani Bharathi manibharat...@gmail.com wrote:
What will be the output of the following program
#include
int main()
{
int m=10,p;
p=incre(incre (incre (++) incre) incre)
@rajkumar: thanks
#include stdio.h
#define max(a,b) ((ab)?a:b)
int main()
{
int m,n;
m=3+max(2,3);
n=2*max(3,2);
printf(%d,%d,m,n);
getchar();
return 0;
}
this gives the correct output as 6,6
On Mon, Aug 8, 2011 at 7:12 PM, Dipankar Patro dip10c...@gmail.com wrote:
relational
#include stdio.h
#define max(a,b)(ab)?a:b
int main()
{
int m,n;
m=3+max(2,3);
n=2*max(3,2);
printf(%d,%d,m,n);
getchar();
return 0;
}
y the o/p is 2,3,,please explain
--
Regards,
Kamakshi
kamakshi...@gmail.com
--
You received this message because you are subscribed to the Google
Precedence of + is higher than ?
On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote:
#include stdio.h
#define max(a,b)(ab)?a:b
int main()
{
int m,n;
m=3+max(2,3);
n=2*max(3,2);
printf(%d,%d,m,n);
getchar();
return 0;
}
y the o/p is
#define max(a,b)((ab)?a:b)
use parenthese thn it will giv the correct o/p
On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal
kamakshi...@gmail.com wrote:
#include stdio.h
#define max(a,b)(ab)?a:b
int main()
{
int m,n;
m=3+max(2,3);
n=2*max(3,2);
printf(%d,%d,m,n);
getchar();
thanks..got it...
On Mon, Aug 8, 2011 at 3:45 PM, jagrati verma
jagrativermamn...@gmail.comwrote:
#define max(a,b)((ab)?a:b)
use parenthese thn it will giv the correct o/p
On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal
kamakshi...@gmail.com wrote:
#include stdio.h
#define
the statement will be transformed to :
m=3+(23)?2:3;
n=2*(32)?3:2;
which will become
m = 3 + 0 ? 2 : 3;
n = 2 * 1 ? 3 : 2;
On Mon, Aug 8, 2011 at 3:46 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote:
thanks..got it...
On Mon, Aug 8, 2011 at 3:45 PM, jagrati verma
I think you forgot to give a space between macro and it's expansion that's
why
max(a,b)(ab)?a:b
is getting expanded to null
and the above result
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Sorry that's not the reason i running that code on my machine i understood
the reason is something else
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
how 2,3 any idea??
On Mon, Aug 8, 2011 at 5:09 PM, raj kumar megamonste...@gmail.com wrote:
I think you forgot to give a space between macro and it's expansion that's
why
max(a,b)(ab)?a:b
is getting expanded to null
and the above result
--
You received this message because you are
3+23?2:3
so 53 hence 2 is returned bcoz of higher precedence of + over ?
Thanks
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
@raj,
the preprocessed file would contain m=3+(23)?2:3 AFAIK.
So, the statement would evaluate to 3 + 1 ? 2 : 3 == 4 ? 2 : 3 ==
m = 2.
Likewise for n.
On Mon, Aug 8, 2011 at 5:21 PM, raj kumar megamonste...@gmail.com wrote:
3+23?2:3
so 53 hence 2 is returned bcoz
oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 == *3* ?
2 : 3 == m = 2.
On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C sachindr...@gmail.comwrote:
@raj,
the preprocessed file would contain m=3+(23)?2:3 AFAIK.
So, the statement would evaluate to 3 + 1 ? 2
Since test condition will always evaluate to non-zero value (which is
considered true in c/c++) hence always first option get selected
On 8 August 2011 17:44, Shachindra A C sachindr...@gmail.com wrote:
oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 == *3*? 2
: 3 == m
in expression (ab)?a:b---(ab) returns 1 if true and 0 if
(false) .
On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana dilipmakwa...@gmail.comwrote:
Since test condition will always evaluate to non-zero value (which is
considered true in c/c++) hence always first option get selected
relational operators give 0/1 output;
(ab) - will be either 0 or 1.
similarly (a==b) will either be 0 or 1
On 8 August 2011 18:39, Anil Arya anilarya...@gmail.com wrote:
in expression (ab)?a:b---(ab) returns 1 if true and 0 if
(false) .
On Mon, Aug 8, 2011 at 6:08 PM, dilip
what is the problem with the following code
void fun(int **p)
{
static int q = 10;
*p = q;
}
int main()
{
int r = 20;
int *p = r;
fun(*p);
printf(%d, *p);
getchar();
return 0;
}
--
Regards,
Kamakshi
kamakshi...@gmail.com
--
You received this message because you are
what s the o/p of the followin pgm?
main()
{
int i=300;
char *ptr;
ptr=i;
*++ptr=2;
printf(%d,i);
}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
i think it will be 34...
Thanks and regards,
Gajendra Dadheech
On Sun, Feb 6, 2011 at 10:15 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote:
@ranjane
the value of i will not change as ++ptr will execute first.
but i wonder if a char pointer can be used to store integer address... will
i do'nt know why it is printing 556.
could anyone give me the logic.
Aditya Pratap
MCA II
Delhi University
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from
@aditya which compiler are you using
On Sun, Feb 6, 2011 at 10:21 PM, aditya pratap
contacttoadity...@gmail.comwrote:
i do'nt know why it is printing 556.
could anyone give me the logic.
Aditya Pratap
MCA II
Delhi University
--
You received this message because you are subscribed to
@jalaj : gcc compiler.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options,
the logic is :-
int is stored in 32 bits in our systems
300 is 0001 00101100
as ptr is character pointer, it points to lower 8 bits
and when *++ptr=2 gets executed then 0001 changes to 0010(equal to
2)
so i becomes 0010 00101100 which is 556 :D
Hi All,
char s[]={'a', 'b', 'c', 'd'};
printf(%d\n, strlen(s));
o/p is 8
can anybody plz explain why 8 ?
Mohit
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To
you didn't put an '\0' at the end of the string
strlen looks for a '\0' in the string and here it happened to be 8
bytes after the starting position of s
On 6/15/10, mohit ranjan shoonya.mo...@gmail.com wrote:
Hi All,
char s[]={'a', 'b', 'c', 'd'};
printf(%d\n, strlen(s));
o/p is 8
can
#includestdio.h
int main()
{
short int i=0;
for(i=5i=-1;++i;i0)
printf(%u\n,i);
return 0;
}
o/p coming is 1...4,294,967,295
short int is of 2 bytes
can any one plzz explain the o/p
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
output on my compiler is 165535
as i=0 initialy ++i is true and so for loop condition is true and printf is
executed. when i becomes 65535 then ++i is equal to 0 and so for loop
condition becomes false.
On 5 June 2010 13:44, sharad sharad20073...@gmail.com wrote:
#includestdio.h
int main()
@divya,which compiler u r using,i m getting this o/p on gcc compiler
@mohit:loop stops at 4,294,967,295 in gcc
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe
If you make it unsigned short int.. then it goes to 65535 on g++/gcc
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
--
You received this message because you are
turbo c++ and my o/p is logical as well
On 5 June 2010 17:58, sharad kumar sharad20073...@gmail.com wrote:
@divya,which compiler u r using,i m getting this o/p on gcc compiler
@mohit:loop stops at 4,294,967,295 in gcc
--
You received this message because you are subscribed to the Google
32 matches
Mail list logo