Wat is the use of ## in define??
#include stdio.h
#define f(g,g2) g##g2
void main()
{
int var12 =100;
printf(%d,f(var,12));
}
o/p :100
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
it joins the variables together ... for eg 1##2 = 12
--
*Parag Khanna
B.tech Final Year
NIT,Kurukshetra*
--
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
On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote:
it joins the variables together ... for eg 1##2 = 12 or a##b=ab
--
*Parag Khanna
B.tech Final Year
NIT,Kurukshetra*
--
*Parag Khanna
B.tech Final Year
NIT,Kurukshetra*
--
You received this message
@parag thnx...
btw is dere ny source dat has ny info bout it??
Regards,
Payal Gupta,
3rd year,
NIT-Bhopal
On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote:
On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote:
it joins the variables
yes payal read a standard c book like dennis ritchie ... these are the
best source
On Sat, Jan 7, 2012 at 1:53 AM, payal gupta gpt.pa...@gmail.com wrote:
@parag thnx...
btw is dere ny source dat has ny info bout it??
Regards,
Payal Gupta,
3rd year,
NIT-Bhopal
On Sat, Jan 7, 2012 at
## concatenating operator
On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:
yes payal read a standard c book like dennis ritchie ... these are the
best source
On Sat, Jan 7, 2012 at 1:53 AM, payal gupta gpt.pa...@gmail.com wrote:
@parag thnx...
btw
@utkarsh n tejbala ...thnx..4 d info.
Regards,
Payal gupta,
3rd year,cse,
NIT-Bhopal
On Sat, Jan 7, 2012 at 9:30 AM, teja bala pawanjalsa.t...@gmail.com wrote:
## concatenating operator
On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV usrivastav...@gmail.com
wrote:
yes payal read
In any C program,
int main(){
char a[100];
foo(a);
printf(%d, sizeof(a));
}
foo(char *s){
printf(%d, sizeof(a));
}
In main sizeof a is 100, in foo it is 4. why??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
foo(char *s){
printf(%d, sizeof(s)); // correction
}
in this function foo s is a pointer so it print size of pointer which is 4 .
On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh love.for.programm...@gmail.com
wrote:
In any C program,
int main(){
char a[100];
foo(a);
printf(%d, sizeof(a));
array is always given a special treatment...its nt a constant ptrits
an array means 100 bytes r resrvd for it
for this i think u mst go thru pointers in c and ritchi books.
On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh love.for.programm...@gmail.com
wrote:
foo(char []s){
char *p,char [] are both same they both have size 4
On Sat, Sep 3, 2011 at 6:18 AM, himanshu kansal himanshukansal...@gmail.com
wrote:
array is always given a special treatment...its nt a constant
ptrits an array means 100 bytes r resrvd for it
for this i think u mst go thru
As declaration of a[100] is defined in main function so main function print
100 , but foo() only know a pointer to a char data type that is why it print
4 in function foo()
correct me if i am wrong!
On Sat, Sep 3, 2011 at 6:52 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:
char *p,char
See, a is defined in main() therefore its scope is limited to main(). It is
stored probably in main()'s stack
When you pass it to a function as a pointer. You don't make a copy of 'a'
onto the function's stack.
The only way you can view, manipulate it is using a pointer, and that
pointer is your
ok i got this point.
Plz answer this,
s is a pointer in foo and a is also a constant pointer in main. (a is passed
to foo)
However, in main a is treated as an rvalue and in s the same pointer is an
lvalue. why??
--
You received this message because you are subscribed to the Google Groups
Isn't it obvious now?
--
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,
when u pass array as an argument to a function only the starting address is
passed .so sizeof(a) is address of pointer !
On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh love.for.programm...@gmail.com
wrote:
In any C program,
int main(){
char a[100];
foo(a);
printf(%d, sizeof(a));
}
foo(char
Thank,,,Now got it.
On Tue, Aug 23, 2011 at 11:22 AM, nagarajan naga4...@gmail.com wrote:
Hi Vijay,
i = 10 10 5
= 0 5
= 1
On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar
vijaykhand...@gmail.comwrote:
main()
{
int x=10,y=10,z=5;
int i=xyz;
pf(\n%d,i);
}
o/p is 1 .pls
main()
{
int x=10,y=10,z=5;
int i=xyz;
pf(\n%d,i);
}
o/p is 1 .pls any1 explain me hw is it printing?
--
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
Hi Vijay,
i = 10 10 5
= 0 5
= 1
On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar vijaykhand...@gmail.comwrote:
main()
{
int x=10,y=10,z=5;
int i=xyz;
pf(\n%d,i);
}
o/p is 1 .pls any1 explain me hw is it printing?
--
You received this message because you are subscribed to the
Can you explain me shortly how 5.375 is converted into normalised
form...How to find mantissa and Exponent in this case? Plz Explain
meVijay
On Sun, Aug 21, 2011 at 1:25 PM, Rahul Tiwari rahultiwari6...@gmail.comwrote:
On Sun, Aug 21, 2011 at 11:11 AM, Rahul Tiwari
FUNC2(i) = i==0?i*(i-1*(i-1-1))
8==0?1:8*(8-1*(8-1-1))
8==0?1:8*(8-6)
8==0?1:8*2
8==0?1:16
hence it will return 16
On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra
sudhir08.mis...@gmail.comwrote:
#includestdio.h
#define FUNC1(i) (i*(i-1))
#define FUNC2(i) (i==0?1:i*FUNC1(i-1))
main()
{
+1 to sagar
Sanju
:)
On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.com wrote:
FUNC2(i) = i==0?i*(i-1*(i-1-1))
8==0?1:8*(8-1*(8-1-1))
8==0?1:8*(8-6)
8==0?1:8*2
8==0?1:16
hence it will return 16
On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra
doesn it work like below ?
func2(8)= 8 * func1(7)
func1(7)= 7*6
so i=8*7*6???
On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal srn...@gmail.com wrote:
+1 to sagar
Sanju
:)
On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.comwrote:
FUNC2(i) = i==0?i*(i-1*(i-1-1))
Nopes, its a funda of PRE-PROCESSOR directives.
Look before the object code is generated for the program, all the occurences
of the MACROs are replaced with their expansions as such as in the
definition.
So what u r doing is completely wrong.
For more info on MACROs, refer any text book of C.
check this link..
http://en.wikipedia.org/wiki/Single_precision_floating-point_format
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.
To post
Thank u very much Abhishek for this link, Now I got it ...But also u
explain me in following..
5.375 is represents 0100 1010 1100 means 4 0 A C 0
0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
left or L to R I m little
Compiler is little endian so as u have typecasted it to char pointer then
0100 1010 1100 means 4 0 A C 0 0 0 0 it will show
o/p byte by byte from LSB.
On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote:
Thank u very much Abhishek for this link,
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40
On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla puneetchawla...@gmail.comwrote:
Compiler is little endian so as u have typecasted it to char pointer then
0100 1010 1100 means 4 0 A C 0 0 0 0 it will
I was thinking the same ..byte by byte from R to L thank u very
muchNow i have got it..On Sun, Aug 21, 2011 at 6:01 PM,
Puneet Chawla puneetchawla...@gmail.com wrote:
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40
On Sun, Aug 21, 2011 at 6:00 PM,
Thanks puneet ...
On Sun, Aug 21, 2011 at 6:01 PM, Puneet Chawla puneetchawla...@gmail.comwrote:
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40
On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla
puneetchawla...@gmail.comwrote:
Compiler is little endian so as
thnx:)
On Sun, Aug 21, 2011 at 9:26 AM, Sanjay Rajpal srn...@gmail.com wrote:
See you are considering one bit of bit1, and printing it as signed integer.
So what i think is that '1' bit will be treated as while treating
it as Signed Integer, and this is the binary representation of
it can also be understood as, range of signed integers are
-2^(no. of bits-1) to 2^(no. of bits-1)-1
so here is only one bit so its range will be from -1 to 0.
that's why storing 1 means -1.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
float is 4 bytes.
so a=3.75 will be stored in 4 bytes in memory.
the moment you have a pointer referring to the same memory location but type
cast to (char *), the pointer will refer to character i.e. 1 byte.
^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75
now finally the o/p
+1 to Dipankar
Sanju
:)
On Sat, Aug 20, 2011 at 12:01 AM, Dipankar Patro dip10c...@gmail.comwrote:
float is 4 bytes.
so a=3.75 will be stored in 4 bytes in memory.
the moment you have a pointer referring to the same memory location but
type cast to (char *), the pointer will refer to
5.375 in normalised form is - 0100 1010 1100
As we type cast into char
so in little endian system it take 8 bits from last and store into p[0] ,
then it take next 8 bits store it into p[1] so on ...
In printf statement here X is specifier for float so it print hexadecimal
See if a number is power of 2, then only one bit in the number will be set.
e.g. for 16, 0001 assuming 8-bit representation.
then when you subtract 1 from this number, the bits to the right of the
previously set bit will be set, and the set bit will become unset.
e.g. 16 will become 15,
@sandeep
number which is a power of 2 only one bit will be set.
number -1 : all the bits except the one which was set at num with be 1
so num num-1 will be 0 coz of bitwise and
On Sat, Aug 20, 2011 at 4:15 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:
explain it plz
On Sat, Aug 20, 2011
@sukran explain plz
On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan sukrandha...@gmail.comwrote:
one more condition is required
if(num != 0 !( num (num-1))
On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal srn...@gmail.com wrote:
if(!(x x-1)) printf(No. is power of 2);
Sanju
:)
On
@sandeep
number which is a power of 2 only one bit will be set.
number -1 : all the bits except the one which was set at num with be 1
so num num-1 will be 0 coz of bitwise and
On Sat, Aug 20, 2011 at 4:18 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:
@sukran explain plz
On Sat, Aug 20,
okey thnks @sukran.. :)
On Sat, Aug 20, 2011 at 4:20 PM, sukran dhawan sukrandha...@gmail.comwrote:
@sandeep
number which is a power of 2 only one bit will be set.
number -1 : all the bits except the one which was set at num with be 1
so num num-1 will be 0 coz of bitwise and
On Sat, Aug
#includestdio.h
main()
{
struct value
{
int bit1:1;
int bit2:4;
int bit3:4;
}bit={1,2,2};
printf(%d%d%d,bit.bit1,bit.bit2,bit.bit3);
}
output is -1,2,2;
can anybody tell me the reason that y it is giving -1 ??
--
You received this message because you are subscribed to the Google Groups
Read bit field
On Sun, Aug 21, 2011 at 2:44 AM, Nitin coolguyinat...@gmail.com wrote:
#includestdio.h
main()
{
struct value
{
int bit1:1;
int bit2:4;
int bit3:4;
}bit={1,2,2};
printf(%d%d%d,bit.bit1,bit.bit2,bit.bit3);
}
output is -1,2,2;
can anybody tell me the reason that
only one bit is reserved for it.so the binary representation is 1.since only
one bit is present,
that bit becomes sign nit and hence -1
On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh saurab...@gmail.com wrote:
Read bit field
On Sun, Aug 21, 2011 at 2:44 AM, Nitin coolguyinat...@gmail.com
See you are considering one bit of bit1, and printing it as signed integer.
So what i think is that '1' bit will be treated as while treating
it as Signed Integer, and this is the binary representation of
-1. Hence the result.
If you write it as unsigned int bit1:1, the result is 122.
but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00
00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2]
pts AC or 1010 1100 and p[3] pts to 40 or 0100 ONLY in this
way..Vijay Khandar...
On Sat, Aug 20, 2011 at 12:31 PM,
@vijay
u take normalised form of 5.375 wrong .
actual normalised form of 5.375 = 0100 1000 1010 1100
On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar vijaykhand...@gmail.comwrote:
but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00
If the binary equivalent of 5.375 in normalised form is - 0100
1010 1100
what is the o/p of following code-
main()
{
float a=5.375;
char *p;
int i;
p=(char *)a;
for(i=0;i=3;i++)
printf(%02X,(unsigned char)p[i]);
}
O/P= 00 00 AC 40
Plz, Plz anyone explain me in detail,
The problem is because of \n in the prnintf statement. When new line is
there in first printf it flushes the standard buffer and so in child the
output of printf is not present in second program.
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*
On Sat, Aug 13, 2011 at 9:29 PM, Ankur Khurana
#includestdio.h
#includeunistd.h
int main()
{
int return_value;
printf(forking process);
fork();
printf(hello\n);
return 0;
}
in the above program the output is
forking processhello
forking processhello
but in the below prog
includestdio.h
#includeunistd.h
int main()
{
int
aren't two programs same ? and scheduling of two forked and parent process
is prcoessor dependent. You dont have a say in it.
On Sun, Aug 14, 2011 at 1:21 AM, thanu moorthy moorthyth...@gmail.comwrote:
#includestdio.h
#includeunistd.h
int main()
{
int return_value;
printf(forking
hmm ya am sorry abt that..what abt the first part i mentioned...how is it
(nodeptr*)malloc according to you (which is creating a pointer to a pointer
type nodeptr )rather than just nodeptr which is a pointer to structure?
how to get size of structure as such in this case?
On Thu, Aug 11, 2011 at
@siddarth:
should not the statement you mentioned above as
nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*));
be
nodeptr h =(struct*)malloc(sizeof(struct)); ??
cos malloc returns pointer to memory block and nodeptr itself is a pointer
and you have used nodeptr* further?
On Tue, Aug 9, 2011 at
@ram got it. tanx :)
--
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,
(sizeof(struct)); ??
That doesn't makes sense. Size of struct is what ?? you need the size of
your structure with the variables you have declared in it.
cos malloc returns pointer to memory block and nodeptr itself is a pointer
and you have used nodeptr* further?
On Tue, Aug 9, 2011 at
*typedef struct {**
*
*char * a;**
*
*nodeptr next;**
*
*}*nodeptr;**
*
*
*
*what does nodeptr stand for??*
--
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
it will give error in line 3 because nodeptr is undefined till that point..
On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com
wrote:
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
yep it will !!
any ways nodeptr is another name for pointer to the same structure so you
dont need to write structname *nodeptr
you can simply write nodeptr *p(say) to declare pointer to the structure
On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com wrote:
it will give error
#includestdio.htypedef struct {char * a;
}*nodeptr;
main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);}
this gives an error. Please explain the concept behind this.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
is it giving an error at *nodeptr declaration?
On Tue, Aug 9, 2011 at 8:26 PM, programming love
love.for.programm...@gmail.com wrote:
#includestdio.htypedef struct {char * a;
}*nodeptr;
main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);}
this gives an error. Please explain the
Hi
On 9 August 2011 20:26, programming love love.for.programm...@gmail.comwrote:
#includestdio.htypedef struct {char * a;
}*nodeptr;
main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);}
this gives an error. Please explain the concept behind this.
You have used typedef incorrectly
dont use *h just use h
On Tue, Aug 9, 2011 at 8:31 PM, siddharth srivastava akssps...@gmail.comwrote:
Hi
On 9 August 2011 20:26, programming love
love.for.programm...@gmail.comwrote:
#includestdio.htypedef struct {char * a;
}*nodeptr;
main(){nodeptr *h;h-a=programming;printf(hi %s\n,
this gives an error. Please explain the concept behind this.
try using something like this:
#includestdio.h
#includemalloc.h
typedef struct {
char * a;
}* nodeptr;
main(){
nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*));
h-a=programming;
printf(hi %s\n, h-a);
}
though
typedef struct{
a new pointer type that can store the address of such structure
for example
nodeptr p;
will declare a pointer to that struct
but it is useless for me.
On Aug 9, 2011 8:19 PM, programming love love.for.programm...@gmail.com
wrote:
@rohith, what if that statement is removed. Now, what will
#includestdio.htypedef struct {char * a;
}*nodeptr;
main(){nodeptr h;h-a=programming;printf(hi %s\n, h-a);}
@sidharth: thanks a lot for correcting me :)
@aditya : no. there was some mistake;
in the code i pasted above it's giving segmentation fault. Is it cause i'm
initializing h without using
when you declared h it contains garbage address . h-a is meaningless .
read pointers chapter from K nd R for full details about pointers in C .
On Aug 9, 2011 9:11 PM, programming love love.for.programm...@gmail.com
wrote:
#includestdio.htypedef struct {char * a;
}*nodeptr;
main(){nodeptr
@sidharth: thanks a lot for correcting me :)
@aditya : no. there was some mistake;
in the code i pasted above it's giving segmentation fault. Is it cause i'm
initializing h without using malloc??
Please throw light on this problem
Pointer points to a location in memory. You can't use h
main()
{
char a=129;
printf(%0x,a);
}
the o/p whch i'm getting s ff81.. why is tat so?
as char s 1 byte why 2 bytes r printed...
--
karthikeyankkn
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Correct me if i'm wrong. I think it's cos at a time it'll fetch the amount
of bytes = to it's register's size.
If a 32-bit machine is being used, answer will contain 4 bytes
ff81
16-bit machine - ff81
--
You received this message because you are subscribed to the Google Groups
signed char 129 = -127
127 = 0111
-127 = 1000 0001 (2's compliment form) = ff81 (hex)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
main()
{
int i,j;
i=10;
j=sizeof(++i);
printf(%d,i);
}
please give the output with explanation!
--
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,
output would be 10
size of just calculate the type of the expression not the value
Best Wishes
Sachin Sharma
--
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
i=10
--
*Rajeshwar Patra,*
*MCA final year,*
*Nit Durgapur*
--
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
sizeof is not a function. The inside content in sizeof() cannot be compiled
during the compiling time, It will be replaced with the type. For example,
compiler will replace the code as j = 4;
So ++i does not execute.
On Aug 3, 2011, at 6:12 PM, brijesh wrote:
main()
{
int i,j;
i=10;
Please give the output and explain..
main()
{
int i=7;
printf(%d\n,i++*i++);
printf(%d\n,i++*++i);
printf(%d\n,++i*i++);
printf(%d\n,++i*++i);
}
What is the order of execution!?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Its compiler dependent. Acc. to the C standard an object's stored value can
be modified only once in an expression.
--
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
As we know:
In an expression, if pre n post occur
simultaneously, pre inc the value then n there only n post executes it
after that expression...and expression evaluates right to left...
Also, the value of a variable in an expression can be modified
multifold times...there
output ll be 10..sizeof operation just find the size of the variable's
datatype..no changes for the variable inside the operation..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
for(i=1,j=10;i6;++i,--j)
pf(%d %d,i,j);
and
for(i=1,j=10;i6;i++,j--)
pf(%d %d,i,j);
why this both giving same o/p, since one is pre and other is
postplz explain me
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
Actually incrementing and decrementing whether pre and post will not
affect in this case because (increment and decrement ) will be done
before checking the condition.
As in for loop three sequential steps are .
1. Initialization
2. Checking condition
3. Increment or decrement
On Tue, Aug
coz we do in for loop 1st initialization thn condition thn increment so in
1st for loop it will print the value thn increment the i's value so itll
behave like a i++
dats y no diffrence in the o/p
:):)
--
You received this message because you are subscribed to the Google Groups
Algorithm
Thanks Naveen..
On Tue, Aug 2, 2011 at 3:13 PM, naveen shukla
naveenshuklasweetdrea...@gmail.com wrote:
Actually incrementing and decrementing whether pre and post will not
affect in this case because (increment and decrement ) will be done
before checking the condition.
As in for
Thanks Jagrati
On Tue, Aug 2, 2011 at 3:19 PM, jagrati verma
jagrativermamn...@gmail.comwrote:
coz we do in for loop 1st initialization thn condition thn increment so
in 1st for loop it will print the value thn increment the i's value so itll
behave like a i++
dats y no
Becaus eof Bitwise and
0110 (6)
0001 0010 (10)
0010 (2)
So
00 0
01 0
10 0
11 1
On Mon, Aug 1, 2011 at 3:31 PM, Vijay Khandar vijaykhand...@gmail.comwrote:
main()
{
int a=6,b=10,x;
x=ab;
printf(%d,x);
}
O/P=2
Plz any one explain
main()
{
int a=6,b=10,x;
x=ab;
printf(%d,x);
}
O/P=2
Plz any one explain me ,how its come
--
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
Now got it Thanks...
On Wed, Jul 27, 2011 at 11:27 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
The output is 10101101
consider it to be f(173) - f(86) - f(43) - f(21) - f(10) - f(5) -
f(2) - f(1)
1 0 110
1
#includestdio.h
#includeconio.h
int f(int n)
{
if(n=1)
{
printf( %d,n);
}
else
{
f(n/2);
printf( %d,n%2);
}
}
void main()
{
clrscr();
f(173);
getch();
}
o/p-1 0 1 0 1 1 0 1
but i m getting 1 0 1 1 0 1 0 1
plz explain me...
--
You received this message because you are subscribed to
I am getting the proper output :) 1 0 1 0 1 1 0 1
*Muthuraj R.
4TH Year BE.**
Information Science Dept*
*PESIT, Bengaluru .
*
On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar vijaykhand...@gmail.comwrote:
#includestdio.h
#includeconio.h
int f(int n)
{
if(n=1)
{
printf( %d,n);
}
The output is 10101101
consider it to be f(173) - f(86) - f(43) - f(21) - f(10) - f(5) - f(2)
- f(1)
1 0 110
1 01
Hope you get the recursion there .
On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar
@vijay
put return n int function f(),
you will get expected out put.
as like this...
#includestdio.h
#includeconio.h
int f(int n)
{
if(n=1)
{
printf( %d,n);
return n;
}
else
{
f(n/2);
printf( %d,n%2);
return n;
}
}
void main()
{
clrscr();
f(173);
getch();
}
--
You received this message
#includestdio.h
#includeconio.h
int f(int n,int k)
{
if (n==0)
return 0;
else
if(n%2)
return f(n/2,2*k)+k;
else return f(n/2,2*k)-k;
}
int main()
{
clrscr();
printf(\n %d,f(20,1));
getch();
}
O/p is 9.Plz explai me how it is come
Vijay.
--
You received this message
in the frst pass its passed as f(20,1) n%2 =0 so else condition will be
returned ie. f(10,2) -1
now in f(10,2) agn else and return will be f(5,4)-2
now n%2=1 so return will be f(2,8) +4
f(2,8) will be agn else and return will be f(1,16)-8
now fr f(1,16) return will be f(0,32) +16
and now at last
f(20,1)-f(10,2)-1- f(5,4)-2 -f(2,8) +4 -
f(1,16)-8 - f(0,32) +16-return 0
10-1=9 12-2=10 - 8+4=12 16-8=8
0+16 - -
*Muthuraj R.
4TH Year BE.**
Information Science Dept*
*PESIT, Bengaluru .
*
Thanks MuthurajI got it..
On Mon, Jul 25, 2011 at 9:42 PM, sameer.mut...@gmail.com
sameer.mut...@gmail.com wrote:
f(20,1)-f(10,2)-1- f(5,4)-2 -f(2,8) +4 -
f(1,16)-8 - f(0,32) +16-return 0
10-1=9 12-2=10 - 8+4=12
Thanks Aditi..I got it...
On Mon, Jul 25, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote:
in the frst pass its passed as f(20,1) n%2 =0 so else condition will be
returned ie. f(10,2) -1
now in f(10,2) agn else and return will be f(5,4)-2
now n%2=1 so return will be f(2,8) +4
To clear pointer basics and dwell deep into the subject please WORK
OUT THESE video series ALONGwith The assignments . .
http://see.stanford.edu/see/lecturelist.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755ee
On 6/8/11, Vishal Thanki vishaltha...@gmail.com wrote:
Following declaration makes the
anything that is declared volatilecompiler dont apply its optimization
on that storage
i.e it dont remove the redundant memory accesses
in case of a normal volatile variable ,its value is checked everytime it is
used in the program
compiler dont make any assumptions
similarly in case of
@Aditya; Thanks..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/UO6vAXBXhXEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To
a volatile pointer to a volatile pointer to integer
int *volatile *p;
a pointer to a volatile pointer to interger
On Wed, Jun 8, 2011 at 11:28 AM, Vishal Thanki vishaltha...@gmail.comwrote:
Following declaration makes the x as a volatile pointer to an integer.
int *volatile x;
But what
@Aditya:- can u give a brief intro of volatile pointer.
Thanks.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/SJkBkvK-MqAJ.
To post to this group, send
Following declaration makes the x as a volatile pointer to an integer.
int *volatile x;
But what does following means?
int **volatile x;
~Vishal
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
100 matches
Mail list logo