Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
For Dev-C++, you have to include one file in another.
So either add *#include file1.c *in file2.c and compile file2.c or
add *#include
file2.c *in file1.c and compile file1.c.

Hope this helps.


*Neeraj Gangwar*
B.Tech. IV Year
Electronics and Communication IDD
Indian Institute of Technology Roorkee
Contact No. : +91 9897073730


On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in file 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 That's why you are getting the error. You have to compile both the files
 together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 but how can i use extern..if i simply declare a variable in file1 as
 int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if i 
 use
 extern in file it means that this variable/fxn is defined somewhr 
 else.then
 what are those files in which it searches this variable definition..i m
 getting errorplese give me 2 files in which one files defines variable
 and other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey rkd7...@gmail.com
  wrote:

 @rahul it will compile perfectly well . note that you have declared j
 in file 1 as extern and used it and have not provided its definition any
 where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 specified by @shobhit

 i am attaching your corrected code which runs fine ...
 file1.c


 #includestdio.h
 extern int i;
 //extern int j; // provide a declaration for this
 void next(void);

 int main()
 {
 ++i;
 printf(%d\n,i);

 next();
 getchar();
 }
 int i=3;
 void next()
 {
 ++i;
 printf(%d\n,i);
 //printf(%d,j); // since no defintion provided so getting error
 other();
 }

 file2.c


 extern int i;
 void other()
 {
 ++i;
 printf(%d\n,i);
 }

 if you want to use j u need to provide defintion either in file 1 or
 file 2
 output:
 4
 5
 6




 On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt
 compile..plz coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have
 “extern” prepended with them. It means even though we don’t use 
 extern with
 the declaration/definition of C functions, it is present there. For
 example, when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.




 extern int foo(int arg1, char arg2);


  On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  Pleaase reply with sol as asp

 Fille 1:
  #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
  extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it
 shows??
 pls provide me o/p of this questiona nd also tell how use use
 variable of one file in other as simply writing extern in a is not 
 

Re: [algogeeks] C o/p adobe

2012-11-16 Thread rahul sharma
but with adding it willl copy aalll the codewe we dont need to copy..if
we declare int i in file 1...and include in file 2..then i can use it in
file 2 with its extern declaration...m i ryt?

On Fri, Nov 16, 2012 at 2:42 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 For Dev-C++, you have to include one file in another.
 So either add *#include file1.c *in file2.c and compile file2.c or add 
 *#include
 file2.c *in file1.c and compile file1.c.

 Hope this helps.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in file
 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 That's why you are getting the error. You have to compile both the files
 together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar y.neeraj2...@gmail.com
  wrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma rahul23111...@gmail.com
  wrote:

 but how can i use extern..if i simply declare a variable in file1 as
 int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if i 
 use
 extern in file it means that this variable/fxn is defined somewhr 
 else.then
 what are those files in which it searches this variable definition..i m
 getting errorplese give me 2 files in which one files defines 
 variable
 and other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey 
 rkd7...@gmail.com wrote:

 @rahul it will compile perfectly well . note that you have declared
 j in file 1 as extern and used it and have not provided its definition 
 any
 where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 specified by @shobhit

 i am attaching your corrected code which runs fine ...
 file1.c


 #includestdio.h
 extern int i;
 //extern int j; // provide a declaration for this
 void next(void);

 int main()
 {
 ++i;
 printf(%d\n,i);

 next();
 getchar();
 }
 int i=3;
 void next()
 {
 ++i;
 printf(%d\n,i);
 //printf(%d,j); // since no defintion provided so getting error
 other();
 }

 file2.c


 extern int i;
 void other()
 {
 ++i;
 printf(%d\n,i);
 }

 if you want to use j u need to provide defintion either in file 1 or
 file 2
 output:
 4
 5
 6




 On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt
 compile..plz coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have
 “extern” prepended with them. It means even though we don’t use 
 extern with
 the declaration/definition of C functions, it is present there. For
 example, when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and
 the compiler treats it as below.


 extern int foo(int arg1, char arg2);


  On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  Pleaase reply with sol as asp

 Fille 1:
  #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
  extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is 

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
Think it this way

If you are compiling only one file in which you have declared variable as
intern, where would compiler find its actual definition because you are *not
compiling *the second file.

*file1.c : file in which variable is defined*

*file2.c : file in which variable is declared as extern*

When you compile both the files together, as compiler sees *extern
*declaration,
it will check if you have defined that variable somewhere. It will only
check files that are being compiled*. So if you are not compiling *file1.c *it
will not check that file. That's why you have to compile both the files
together.

In simple words, what extern does is that it checks if you have defined
that variable somewhere* in the code that is *being compiled. *

Try following codes

*//start of code*

*#includestdio.h*

*main() {*

*extern int i;*

*printf(i = %d, i);*

*return 0;*


*}*

*//end of code*

It will show you an error that variable i has not been defined anywhere in
the file.

*//start of code*

*#includestdio.h*

*main() {*

*extern int i;*

*printf(i = %d, i);*

*return 0;*


*}*

*int i = 7;*

*// end of code*

Try above code, it will run and show you the correct result. Your codes are
doing precisely the same thing.

*#include file1.c* or *#include file2.c* was based on the same idea.

*scope rules apply.

Some lines of *the* book The C Programming Language by Dennis Ritchie:

There must be only one definition of an external variable among all the
files that make up the

source program; other files may contain extern declarations to access it.
(There may also be

extern declarations in the file containing the definition.) Array sizes
must be specified with

the definition, but are optional with an extern declaration.

*Neeraj Gangwar*
B.Tech. IV Year
Electronics and Communication IDD
Indian Institute of Technology Roorkee
Contact No. : +91 9897073730
On Fri, Nov 16, 2012 at 10:52 PM, rahul sharma rahul23111...@gmail.comwrote:

 but with adding it willl copy aalll the codewe we dont need to
 copy..if we declare int i in file 1...and include in file 2..then i can use
 it in file 2 with its extern declaration...m i ryt?


 On Fri, Nov 16, 2012 at 2:42 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 For Dev-C++, you have to include one file in another.
 So either add *#include file1.c *in file2.c and compile file2.c or add
 *#include file2.c *in file1.c and compile file1.c.

 Hope this helps.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in
 file 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 That's why you are getting the error. You have to compile both the
 files together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma rahul23111...@gmail.com
  wrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.com wrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 but how can i use extern..if i simply declare a variable in file1 as
 int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if i 
 use
 extern in file it means that this variable/fxn is defined somewhr 
 else.then
 what are those files in which it searches this variable definition..i m
 getting errorplese give me 2 files in which one files defines 
 variable
 and other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey 
 rkd7...@gmail.com wrote:

 @rahul it will compile perfectly well . note that you have declared
 j in file 1 as extern and used it and have not provided its definition 
 any
 where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
Yes, it would be like copying the code in the other file. You have to find
a way to do it in Dev-C++.
In linux it's simple. Just use *gcc file1.c file2.c *in terminal (as told
earlier).

If you are still confused, Think it this way
If you are compiling only one file in which you have declared variable as
intern, where would compiler find its actual definition because you are *not
compiling *the second file.

*file1.c : file in which variable is defined*
*file2.c : file in which variable is declared as extern*
*
*
When you compile both the files together, as compiler sees *extern
*declaration,
it will check if you have defined that variable somewhere. It will only
check files that are being compiled*. So if you are not compiling *file1.c *it
will not check that file. That's why you have to compile both the files
together.

In simple words, what extern does is that it checks if you have defined
that variable somewhere* in the code that is *being compiled. *

Try following codes
*//start of code*
*#includestdio.h*
*main() {*

*extern int i;*
*printf(i = %d, i);*
*return 0;*

*}*
*//end of code*
It will show you an error that variable i has not been defined anywhere in
the file.
*
*
*//start of code*
*#includestdio.h*
*main() {*

*extern int i;*
*printf(i = %d, i);*
*return 0;*

*}*
*
*
*int i = 7;*
*// end of code*
Try above code, it will run and show you the correct result. Your codes are
doing precisely the same thing.

*#include file1.c* or *#include file2.c* was based on the same idea.

*scope rules apply.

Some lines of *the* book The C Programming Language by Dennis Ritchie:
There must be only one definition of an external variable among all the
files *that make up the*
*source program*; other files may contain extern declarations to access it.
(There may also be
extern declarations in the file containing the definition.) Array sizes
must be specified with
the definition, but are optional with an extern declaration.


*Neeraj Gangwar*
B.Tech. IV Year
Electronics and Communication IDD
Indian Institute of Technology Roorkee
Contact No. : +91 9897073730


On Fri, Nov 16, 2012 at 10:52 PM, rahul sharma rahul23111...@gmail.comwrote:

 but with adding it willl copy aalll the codewe we dont need to
 copy..if we declare int i in file 1...and include in file 2..then i can use
 it in file 2 with its extern declaration...m i ryt?


 On Fri, Nov 16, 2012 at 2:42 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 For Dev-C++, you have to include one file in another.
 So either add *#include file1.c *in file2.c and compile file2.c or add
 *#include file2.c *in file1.c and compile file1.c.

 Hope this helps.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in
 file 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 That's why you are getting the error. You have to compile both the
 files together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma rahul23111...@gmail.com
  wrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.com wrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 but how can i use extern..if i simply declare a variable in file1 as
 int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if i 
 use
 extern in file it means that this variable/fxn is defined somewhr 
 else.then
 what are those files in which it searches this variable definition..i m
 getting errorplese give me 2 files in which one files defines 
 variable
 and other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey 
 rkd7...@gmail.com wrote:

 @rahul it will compile perfectly well . note 

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
Ignore last to last mail. Sorry. Expand previous mail.

*Neeraj Gangwar*
B.Tech. IV Year
Electronics and Communication IDD
Indian Institute of Technology Roorkee
Contact No. : +91 9897073730


On Fri, Nov 16, 2012 at 11:49 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 Yes, it would be like copying the code in the other file. You have to find
 a way to do it in Dev-C++.
 In linux it's simple. Just use *gcc file1.c file2.c *in terminal (as told
 earlier).

 If you are still confused, Think it this way
 If you are compiling only one file in which you have declared variable as
 intern, where would compiler find its actual definition because you are *not
 compiling *the second file.

 *file1.c : file in which variable is defined*
 *file2.c : file in which variable is declared as extern*
 *
 *
 When you compile both the files together, as compiler sees *extern 
 *declaration,
 it will check if you have defined that variable somewhere. It will only
 check files that are being compiled*. So if you are not compiling *file1.c
 *it will not check that file. That's why you have to compile both the
 files together.

 In simple words, what extern does is that it checks if you have defined
 that variable somewhere* in the code that is *being compiled. *

 Try following codes
 *//start of code*
 *#includestdio.h*
 *main() {*

 *extern int i;*
 *printf(i = %d, i);*
 *return 0;*

 *}*
 *//end of code*
 It will show you an error that variable i has not been defined anywhere in
 the file.
 *
 *
 *//start of code*
 *#includestdio.h*
 *main() {*

 *extern int i;*
 *printf(i = %d, i);*
 *return 0;*

 *}*
 *
 *
 *int i = 7;*
 *// end of code*
 Try above code, it will run and show you the correct result. Your codes
 are doing precisely the same thing.

 *#include file1.c* or *#include file2.c* was based on the same idea.

 *scope rules apply.

 Some lines of *the* book The C Programming Language by Dennis Ritchie:
 There must be only one definition of an external variable among all the
 files *that make up the*
 *source program*; other files may contain extern declarations to access
 it. (There may also be
 extern declarations in the file containing the definition.) Array sizes
 must be specified with
 the definition, but are optional with an extern declaration.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 10:52 PM, rahul sharma rahul23111...@gmail.comwrote:

 but with adding it willl copy aalll the codewe we dont need to
 copy..if we declare int i in file 1...and include in file 2..then i can use
 it in file 2 with its extern declaration...m i ryt?


 On Fri, Nov 16, 2012 at 2:42 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 For Dev-C++, you have to include one file in another.
 So either add *#include file1.c *in file2.c and compile file2.c or
 add *#include file2.c *in file1.c and compile file1.c.

 Hope this helps.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in
 file 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar y.neeraj2...@gmail.com
  wrote:

 That's why you are getting the error. You have to compile both the
 files together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.com wrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 but how can i use extern..if i simply declare a variable in file1
 as int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if 
 i use
 extern in file it means that this variable/fxn is defined somewhr 
 else.then
 

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
Ignore last to last mail. Sorry. Do show expanded content in last mail.
On 16 Nov 2012 23:49, Neeraj Gangwar y.neeraj2...@gmail.com wrote:

 Yes, it would be like copying the code in the other file. You have to find
 a way to do it in Dev-C++.
 In linux it's simple. Just use *gcc file1.c file2.c *in terminal (as told
 earlier).

 If you are still confused, Think it this way
 If you are compiling only one file in which you have declared variable as
 intern, where would compiler find its actual definition because you are *not
 compiling *the second file.

 *file1.c : file in which variable is defined*
 *file2.c : file in which variable is declared as extern*
 *
 *
 When you compile both the files together, as compiler sees *extern 
 *declaration,
 it will check if you have defined that variable somewhere. It will only
 check files that are being compiled*. So if you are not compiling *file1.c
 *it will not check that file. That's why you have to compile both the
 files together.

 In simple words, what extern does is that it checks if you have defined
 that variable somewhere* in the code that is *being compiled. *

 Try following codes
 *//start of code*
 *#includestdio.h*
 *main() {*

 *extern int i;*
 *printf(i = %d, i);*
 *return 0;*

 *}*
 *//end of code*
 It will show you an error that variable i has not been defined anywhere in
 the file.
 *
 *
 *//start of code*
 *#includestdio.h*
 *main() {*

 *extern int i;*
 *printf(i = %d, i);*
 *return 0;*

 *}*
 *
 *
 *int i = 7;*
 *// end of code*
 Try above code, it will run and show you the correct result. Your codes
 are doing precisely the same thing.

 *#include file1.c* or *#include file2.c* was based on the same idea.

 *scope rules apply.

 Some lines of *the* book The C Programming Language by Dennis Ritchie:
 There must be only one definition of an external variable among all the
 files *that make up the*
 *source program*; other files may contain extern declarations to access
 it. (There may also be
 extern declarations in the file containing the definition.) Array sizes
 must be specified with
 the definition, but are optional with an extern declaration.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 10:52 PM, rahul sharma rahul23111...@gmail.comwrote:

 but with adding it willl copy aalll the codewe we dont need to
 copy..if we declare int i in file 1...and include in file 2..then i can use
 it in file 2 with its extern declaration...m i ryt?


 On Fri, Nov 16, 2012 at 2:42 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 For Dev-C++, you have to include one file in another.
 So either add *#include file1.c *in file2.c and compile file2.c or
 add *#include file2.c *in file1.c and compile file1.c.

 Hope this helps.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in
 file 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar y.neeraj2...@gmail.com
  wrote:

 That's why you are getting the error. You have to compile both the
 files together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.com wrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 but how can i use extern..if i simply declare a variable in file1
 as int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if 
 i use
 extern in file it means that this variable/fxn is defined somewhr 
 else.then
 what are those files in which it searches this variable definition..i m
 getting errorplese give me 2 files in which one files 

Re: [algogeeks] C o/p adobe

2012-11-16 Thread rahul sharma
ok..thnxi got it.your r ryt n i m ryt too:)..thnx

On Fri, Nov 16, 2012 at 11:54 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 Ignore last to last mail. Sorry. Do show expanded content in last mail.
 On 16 Nov 2012 23:49, Neeraj Gangwar y.neeraj2...@gmail.com wrote:

 Yes, it would be like copying the code in the other file. You have to
 find a way to do it in Dev-C++.
 In linux it's simple. Just use *gcc file1.c file2.c *in terminal (as
 told earlier).

 If you are still confused, Think it this way
 If you are compiling only one file in which you have declared variable as
 intern, where would compiler find its actual definition because you are *not
 compiling *the second file.

 *file1.c : file in which variable is defined*
 *file2.c : file in which variable is declared as extern*
 *
 *
 When you compile both the files together, as compiler sees *extern 
 *declaration,
 it will check if you have defined that variable somewhere. It will only
 check files that are being compiled*. So if you are not compiling *file1.c
 *it will not check that file. That's why you have to compile both the
 files together.

 In simple words, what extern does is that it checks if you have defined
 that variable somewhere* in the code that is *being compiled. *

 Try following codes
 *//start of code*
 *#includestdio.h*
 *main() {*

 *extern int i;*
 *printf(i = %d, i);*
 *return 0;*

 *}*
 *//end of code*
 It will show you an error that variable i has not been defined anywhere
 in the file.
 *
 *
 *//start of code*
 *#includestdio.h*
 *main() {*

 *extern int i;*
 *printf(i = %d, i);*
 *return 0;*

 *}*
 *
 *
 *int i = 7;*
 *// end of code*
 Try above code, it will run and show you the correct result. Your codes
 are doing precisely the same thing.

 *#include file1.c* or *#include file2.c* was based on the same idea.

 *scope rules apply.

 Some lines of *the* book The C Programming Language by Dennis Ritchie:
 There must be only one definition of an external variable among all the
 files *that make up the*
 *source program*; other files may contain extern declarations to access
 it. (There may also be
 extern declarations in the file containing the definition.) Array sizes
 must be specified with
 the definition, but are optional with an extern declaration.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 10:52 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 but with adding it willl copy aalll the codewe we dont need to
 copy..if we declare int i in file 1...and include in file 2..then i can use
 it in file 2 with its extern declaration...m i ryt?


 On Fri, Nov 16, 2012 at 2:42 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 For Dev-C++, you have to include one file in another.
 So either add *#include file1.c *in file2.c and compile file2.c or
 add *#include file2.c *in file1.c and compile file1.c.

 Hope this helps.


 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Fri, Nov 16, 2012 at 9:11 AM, Rahul Kumar Dubey 
 rkd7...@gmail.comwrote:

 @rahulsharma
  file1.c

 #includestdio.h
 extern int i;// defintion provided in this file itself
 extern int j; // definition provided in file2
 void next()
 {
 ++i;
 other();
 }
 int main()
 {
 ++i;
 printf(%d\n,j);
 printf(%d\n,i);
next();
 }
 int i=3;

 // end of file1.c

 file2.c
 extern int i; // declaration of i as extern
 int j=10; // j defined in file2 here which was declared as extern in
 file 1

 void other()
 {
 ++i;
 printf(%d\n,i);
 }
 // end of file2.c

 compile both file together
 as
 rahul@rahul:~gcc file1.c file2.c
 rahul@rahul:~./a.out
 you will get the required output





 On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar 
 y.neeraj2...@gmail.com wrote:

 That's why you are getting the error. You have to compile both the
 files together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.com wrote:

 Which compiler are you using ? Are you compiling both the files
 together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 but how can i use extern..if i simply declare a variable in file1
 as int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if 
 i use
 extern in file it means that this variable/fxn is defined 

Re: [algogeeks] C o/p adobe

2012-11-15 Thread Neeraj Gangwar
Which compiler are you using ? Are you compiling both the files together ?

*Neeraj Gangwar*
B.Tech. IV Year
Electronics and Communication IDD
Indian Institute of Technology Roorkee
Contact No. : +91 9897073730


On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma rahul23111...@gmail.comwrote:

 but how can i use extern..if i simply declare a variable in file1 as int j
 and try to use in file2 with extern then it shows that j nit defined..how
 cum file2 knows in which file j is definedfor e.g if i use extern in
 file it means that this variable/fxn is defined somewhr else.then what are
 those files in which it searches this variable definition..i m getting
 errorplese give me 2 files in which one files defines variable and
 other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahul it will compile perfectly well . note that you have declared j in
 file 1 as extern and used it and have not provided its definition any where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 specified by @shobhit

 i am attaching your corrected code which runs fine ...
 file1.c


 #includestdio.h
 extern int i;
 //extern int j; // provide a declaration for this
 void next(void);

 int main()
 {
 ++i;
 printf(%d\n,i);

 next();
 getchar();
 }
 int i=3;
 void next()
 {
 ++i;
 printf(%d\n,i);
 //printf(%d,j); // since no defintion provided so getting error
 other();
 }

 file2.c


 extern int i;
 void other()
 {
 ++i;
 printf(%d\n,i);
 }

 if you want to use j u need to provide defintion either in file 1 or file
 2
 output:
 4
 5
 6




 On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt compile..plz
 coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have
 “extern” prepended with them. It means even though we don’t use extern 
 with
 the declaration/definition of C functions, it is present there. For
 example, when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.


 extern int foo(int arg1, char arg2);


  On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  Pleaase reply with sol as asp

 Fille 1:
  #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
  extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it
 shows??
 pls provide me o/p of this questiona nd also tell how use use
 variable of one file in other as simply writing extern in a is not 
 accesing
 global a of other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *RAHUL KUMAR DUBEY*
 *BTech-3rd  year *
 *Computer Science Engineering *
 *Motilal Nehru National Institute Of Technology*
 *Allahabad[211004],UP.*

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because 

Re: [algogeeks] C o/p adobe

2012-11-15 Thread rahul sharma
 No...individually...dev cpp..how to compile both together???

On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 Which compiler are you using ? Are you compiling both the files together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma rahul23111...@gmail.comwrote:

 but how can i use extern..if i simply declare a variable in file1 as int
 j and try to use in file2 with extern then it shows that j nit defined..how
 cum file2 knows in which file j is definedfor e.g if i use extern in
 file it means that this variable/fxn is defined somewhr else.then what are
 those files in which it searches this variable definition..i m getting
 errorplese give me 2 files in which one files defines variable and
 other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey rkd7...@gmail.comwrote:

 @rahul it will compile perfectly well . note that you have declared j in
 file 1 as extern and used it and have not provided its definition any where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 specified by @shobhit

 i am attaching your corrected code which runs fine ...
 file1.c


 #includestdio.h
 extern int i;
 //extern int j; // provide a declaration for this
 void next(void);

 int main()
 {
 ++i;
 printf(%d\n,i);

 next();
 getchar();
 }
 int i=3;
 void next()
 {
 ++i;
 printf(%d\n,i);
 //printf(%d,j); // since no defintion provided so getting error
 other();
 }

 file2.c


 extern int i;
 void other()
 {
 ++i;
 printf(%d\n,i);
 }

 if you want to use j u need to provide defintion either in file 1 or
 file 2
 output:
 4
 5
 6




 On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt
 compile..plz coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have
 “extern” prepended with them. It means even though we don’t use extern 
 with
 the declaration/definition of C functions, it is present there. For
 example, when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.

 extern int foo(int arg1, char arg2);


  On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  Pleaase reply with sol as asp

 Fille 1:
  #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
  extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it
 shows??
 pls provide me o/p of this questiona nd also tell how use use
 variable of one file in other as simply writing extern in a is not 
 accesing
 global a of other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *RAHUL KUMAR DUBEY*
 *BTech-3rd  year *
 *Computer Science Engineering *
 *Motilal Nehru National Institute Of Technology*
 *Allahabad[211004],UP.*

  --
 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
 

Re: [algogeeks] C o/p adobe

2012-11-15 Thread Neeraj Gangwar
That's why you are getting the error. You have to compile both the files
together. Search on google. I don't use dev c++.

*Neeraj Gangwar*
B.Tech. IV Year
Electronics and Communication IDD
Indian Institute of Technology Roorkee
Contact No. : +91 9897073730


On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma rahul23111...@gmail.comwrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 Which compiler are you using ? Are you compiling both the files together ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma rahul23111...@gmail.comwrote:

 but how can i use extern..if i simply declare a variable in file1 as int
 j and try to use in file2 with extern then it shows that j nit defined..how
 cum file2 knows in which file j is definedfor e.g if i use extern in
 file it means that this variable/fxn is defined somewhr else.then what are
 those files in which it searches this variable definition..i m getting
 errorplese give me 2 files in which one files defines variable and
 other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey 
 rkd7...@gmail.comwrote:

 @rahul it will compile perfectly well . note that you have declared j
 in file 1 as extern and used it and have not provided its definition any
 where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 specified by @shobhit

 i am attaching your corrected code which runs fine ...
 file1.c


 #includestdio.h
 extern int i;
 //extern int j; // provide a declaration for this
 void next(void);

 int main()
 {
 ++i;
 printf(%d\n,i);

 next();
 getchar();
 }
 int i=3;
 void next()
 {
 ++i;
 printf(%d\n,i);
 //printf(%d,j); // since no defintion provided so getting error
 other();
 }

 file2.c


 extern int i;
 void other()
 {
 ++i;
 printf(%d\n,i);
 }

 if you want to use j u need to provide defintion either in file 1 or
 file 2
 output:
 4
 5
 6




 On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma rahul23111...@gmail.com
  wrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt
 compile..plz coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma rahul23111...@gmail.com
  wrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have
 “extern” prepended with them. It means even though we don’t use extern 
 with
 the declaration/definition of C functions, it is present there. For
 example, when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.


 extern int foo(int arg1, char arg2);


  On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  Pleaase reply with sol as asp

 Fille 1:
  #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
  extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it
 shows??
 pls provide me o/p of this questiona nd also tell how use use
 variable of one file in other as simply writing extern in a is not 
 accesing
 global a of other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *RAHUL KUMAR DUBEY*
 *BTech-3rd  year *
 

Re: [algogeeks] C o/p adobe

2012-11-15 Thread Rahul Kumar Dubey
@rahulsharma
 file1.c

#includestdio.h
extern int i;// defintion provided in this file itself
extern int j; // definition provided in file2
void next()
{
++i;
other();
}
int main()
{
++i;
printf(%d\n,j);
printf(%d\n,i);
   next();
}
int i=3;

// end of file1.c

file2.c
extern int i; // declaration of i as extern
int j=10; // j defined in file2 here which was declared as extern in file 1
void other()
{
++i;
printf(%d\n,i);
}
// end of file2.c

compile both file together
as
rahul@rahul:~gcc file1.c file2.c
rahul@rahul:~./a.out
you will get the required output





On Fri, Nov 16, 2012 at 8:27 AM, Neeraj Gangwar y.neeraj2...@gmail.comwrote:

 That's why you are getting the error. You have to compile both the files
 together. Search on google. I don't use dev c++.

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730


 On Thu, Nov 15, 2012 at 11:32 PM, rahul sharma rahul23111...@gmail.comwrote:

  No...individually...dev cpp..how to compile both together???


 On Thu, Nov 15, 2012 at 9:26 PM, Neeraj Gangwar 
 y.neeraj2...@gmail.comwrote:

 Which compiler are you using ? Are you compiling both the files together
 ?

 *Neeraj Gangwar*
 B.Tech. IV Year
 Electronics and Communication IDD
 Indian Institute of Technology Roorkee
 Contact No. : +91 9897073730



 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 but how can i use extern..if i simply declare a variable in file1 as
 int j and try to use in file2 with extern then it shows that j nit
 defined..how cum file2 knows in which file j is definedfor e.g if i use
 extern in file it means that this variable/fxn is defined somewhr else.then
 what are those files in which it searches this variable definition..i m
 getting errorplese give me 2 files in which one files defines variable
 and other uses using extern.its not working for me

 On Thu, Nov 15, 2012 at 12:08 PM, Rahul Kumar Dubey 
 rkd7...@gmail.comwrote:

 @rahul it will compile perfectly well . note that you have declared j
 in file 1 as extern and used it and have not provided its definition any
 where
 so getting compile error.
 as far as functions are concerned they are external by defaullt as
 specified by @shobhit

 i am attaching your corrected code which runs fine ...
 file1.c


 #includestdio.h
 extern int i;
 //extern int j; // provide a declaration for this
 void next(void);

 int main()
 {
 ++i;
 printf(%d\n,i);

 next();
 getchar();
 }
 int i=3;
 void next()
 {
 ++i;
 printf(%d\n,i);
 //printf(%d,j); // since no defintion provided so getting error
 other();
 }

 file2.c


 extern int i;
 void other()
 {
 ++i;
 printf(%d\n,i);
 }

 if you want to use j u need to provide defintion either in file 1 or
 file 2
 output:
 4
 5
 6




 On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt
 compile..plz coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have
 “extern” prepended with them. It means even though we don’t use extern 
 with
 the declaration/definition of C functions, it is present there. For
 example, when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.



 extern int foo(int arg1, char arg2);


  On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

  Pleaase reply with sol as asp

 Fille 1:
  #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
  extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it
 shows??
 pls provide me o/p of this questiona nd also tell how use use
 variable of one file in other as simply writing extern in a is not 
 accesing
 global a of other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 You received this message because you are subscribed to the Google
 

Re: [algogeeks] C o/p adobe

2012-11-14 Thread Rahul Kumar Dubey
@rahul it will compile perfectly well . note that you have declared j in
file 1 as extern and used it and have not provided its definition any where
so getting compile error.
as far as functions are concerned they are external by defaullt as
specified by @shobhit

i am attaching your corrected code which runs fine ...
file1.c

#includestdio.h
extern int i;
//extern int j; // provide a declaration for this
void next(void);

int main()
{
++i;
printf(%d\n,i);
next();
getchar();
}
int i=3;
void next()
{
++i;
printf(%d\n,i);
//printf(%d,j); // since no defintion provided so getting error
other();
}

file2.c

extern int i;
void other()
{
++i;
printf(%d\n,i);
}

if you want to use j u need to provide defintion either in file 1 or file 2
output:
4
5
6




On Wed, Oct 24, 2012 at 10:56 PM, rahul sharma rahul23111...@gmail.comwrote:

 can nyone provide me dummy code of how exactly to use extern in c..
 in dev environment

 when i declare int i in one fyl
 and try use use with extern int i in another then it doesnt compile..plz
 coment


 On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma rahul23111...@gmail.comwrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA 
 shobhitgupta1...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have “extern”
 prepended with them. It means even though we don’t use extern with the
 declaration/definition of C functions, it is present there. For example,
 when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.

 extern int foo(int arg1, char arg2);


 On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 Pleaase reply with sol as asp

 Fille 1:
 #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
 extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it shows??
 pls provide me o/p of this questiona nd also tell how use use variable
 of one file in other as simply writing extern in a is not accesing global a
 of other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
*RAHUL KUMAR DUBEY*
*BTech-3rd  year *
*Computer Science Engineering *
*Motilal Nehru National Institute Of Technology*
*Allahabad[211004],UP.*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C o/p adobe

2012-10-24 Thread rahul sharma
Pleaase reply with sol as asp

Fille 1:
#includestdio.h
extern int i;

extern int j;
void next(void);
int main()
{
++i;
printf(%d,i);
next();
getchar();
}
int i=3;
void next()
{
 ++i;
 printf(%d,i);
 printf(%d,j);
other();
 }
File 2:
extern int i;

void other()
{
 ++i;
printf(%d,i)'
}

How cum file 1 knows what is other();as we havnet define with
extern void other();
it should be error
but when i include the statemetn extern void other,then also it shows??
pls provide me o/p of this questiona nd also tell how use use variable of
one file in other as simply writing extern in a is not accesing global a of
other file

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p adobe

2012-10-24 Thread SHOBHIT GUPTA
http://www.geeksforgeeks.org/archives/840

By default, the declaration and definition of a C function have “extern”
prepended with them. It means even though we don’t use extern with the
declaration/definition of C functions, it is present there. For example,
when we write.

int foo(int arg1, char arg2);

There’s an extern present in the beginning which is hidden and the compiler
treats it as below.

extern int foo(int arg1, char arg2);


On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma rahul23111...@gmail.comwrote:

 Pleaase reply with sol as asp

 Fille 1:
 #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
 extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it shows??
 pls provide me o/p of this questiona nd also tell how use use variable of
 one file in other as simply writing extern in a is not accesing global a of
 other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p adobe

2012-10-24 Thread rahul sharma
Then why its not running?

On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA
shobhitgupta1...@gmail.comwrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have “extern”
 prepended with them. It means even though we don’t use extern with the
 declaration/definition of C functions, it is present there. For example,
 when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.

 extern int foo(int arg1, char arg2);


 On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma rahul23111...@gmail.comwrote:

 Pleaase reply with sol as asp

 Fille 1:
 #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
 extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it shows??
 pls provide me o/p of this questiona nd also tell how use use variable of
 one file in other as simply writing extern in a is not accesing global a of
 other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p adobe

2012-10-24 Thread rahul sharma
can nyone provide me dummy code of how exactly to use extern in c..
in dev environment

when i declare int i in one fyl
and try use use with extern int i in another then it doesnt compile..plz
coment

On Wed, Oct 24, 2012 at 9:58 PM, rahul sharma rahul23111...@gmail.comwrote:

 Then why its not running?


 On Wed, Oct 24, 2012 at 6:50 PM, SHOBHIT GUPTA shobhitgupta1...@gmail.com
  wrote:

 http://www.geeksforgeeks.org/archives/840

 By default, the declaration and definition of a C function have “extern”
 prepended with them. It means even though we don’t use extern with the
 declaration/definition of C functions, it is present there. For example,
 when we write.

 int foo(int arg1, char arg2);

 There’s an extern present in the beginning which is hidden and the
 compiler treats it as below.

 extern int foo(int arg1, char arg2);


 On Wed, Oct 24, 2012 at 4:40 PM, rahul sharma rahul23111...@gmail.comwrote:

 Pleaase reply with sol as asp

 Fille 1:
 #includestdio.h
 extern int i;

 extern int j;
 void next(void);
 int main()
 {
 ++i;
 printf(%d,i);
 next();
 getchar();
 }
 int i=3;
 void next()
 {
  ++i;
  printf(%d,i);
  printf(%d,j);
 other();
  }
 File 2:
 extern int i;

 void other()
 {
  ++i;
 printf(%d,i)'
 }

 How cum file 1 knows what is other();as we havnet define with
 extern void other();
 it should be error
 but when i include the statemetn extern void other,then also it shows??
 pls provide me o/p of this questiona nd also tell how use use variable
 of one file in other as simply writing extern in a is not accesing global a
 of other file

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c o/p

2012-10-07 Thread rahul sharma
#includestdio.h
int main()
{
int i;
char ch;

scanf(%c,ch);

printf(%d,ch);
 //   getchar();
getchar();
}

when i enter one digit no. it showswhen 2 digit it halts...y so???  we
can store 2 digit number like 65 in 8 bit char???plz tell

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-10 Thread rahul sharma
yeahu r ryt

On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed
firozkhursh...@gmail.comwrote:

 Well, when i compiled the code the output ie i is alway i=2,

 http://ideone.com/AFljo
 http://ideone.com/87waz

 This expression  is ambiguous, and compiler dependent.
 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-10 Thread vikas
he is right.

On Tue, Jul 10, 2012 at 3:13 PM, rahul sharma rahul23111...@gmail.comwrote:

 yeahu r ryt


 On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed 
 firozkhursh...@gmail.com wrote:

 Well, when i compiled the code the output ie i is alway i=2,

 http://ideone.com/AFljo
 http://ideone.com/87waz

 This expression  is ambiguous, and compiler dependent.
 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-10 Thread Kapil Agrawal
++i/i++= 6/6
++i * i++ = 36.00
http://ideone.com/j4n0Q


On Tue, Jul 10, 2012 at 3:13 PM, rahul sharma rahul23111...@gmail.comwrote:

 yeahu r ryt


 On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed 
 firozkhursh...@gmail.com wrote:

 Well, when i compiled the code the output ie i is alway i=2,

 http://ideone.com/AFljo
 http://ideone.com/87waz

 This expression  is ambiguous, and compiler dependent.
 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-09 Thread rahul sharma
what about post increment??

On Sun, Jul 8, 2012 at 10:37 PM, mitaksh gupta mitak...@gmail.com wrote:

 the o/p will be 2 not 1 because of the post-increment operator.

 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?
  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-09 Thread Firoz Khursheed
int i=5;
i=++i/i++;
print i;


i=1
coz ++ operator in c has preference from right to left, therefor  first
(i++ is ca;cu;ated) i=5 is used then it's incremented ie i=6 now. Now at
this point of time ++i is calculated, which makes i=7;
finally / operator is performed and i=7/5 is calculated, which makes i=1.

Similarly,
 int b=a++*a--;
can be calculated using the preference rule.

On Mon, Jul 9, 2012 at 12:16 PM, rahul sharma rahul23111...@gmail.comwrote:

 what about post increment??


 On Sun, Jul 8, 2012 at 10:37 PM, mitaksh gupta mitak...@gmail.com wrote:

 the o/p will be 2 not 1 because of the post-increment operator.

 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?
  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Firoz Khursheed
Computer Science  Engineering

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-09 Thread rahul sharma
i dont think it will work like u said...7/5i think it will go as
6/6=1..explain nyone???

On Mon, Jul 9, 2012 at 6:38 PM, Firoz Khursheed firozkhursh...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1
 coz ++ operator in c has preference from right to left, therefor  first
 (i++ is ca;cu;ated) i=5 is used then it's incremented ie i=6 now. Now at
 this point of time ++i is calculated, which makes i=7;
 finally / operator is performed and i=7/5 is calculated, which makes i=1.

 Similarly,
  int b=a++*a--;
 can be calculated using the preference rule.

 On Mon, Jul 9, 2012 at 12:16 PM, rahul sharma rahul23111...@gmail.comwrote:

 what about post increment??


 On Sun, Jul 8, 2012 at 10:37 PM, mitaksh gupta mitak...@gmail.comwrote:

 the o/p will be 2 not 1 because of the post-increment operator.

 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?
  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Firoz Khursheed
 Computer Science  Engineering

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-09 Thread Firoz Khursheed
Well, when i compiled the code the output ie i is alway i=2,

http://ideone.com/AFljo
http://ideone.com/87waz

This expression  is ambiguous, and compiler dependent.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C o/p

2012-07-08 Thread rahul sharma
int i=5;
i=++i/i++;
print i;


i=1

how?

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread adarsh kumar
Firstly, this is ambiguous and expressions with multiple
increment/decrement operators will get executed according to the compiler.

Even if you consider the normal way, as we(humans) percieve it, it will be
evaluated as
(++i)/(i++), which is 6/5, which is 1.

Simple!



On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread adarsh kumar
Sorry, its 6/6 and not 6/5,

regds.

On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.com wrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the compiler.

 Even if you consider the normal way, as we(humans) percieve it, it will be
 evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread md shaukat ali
agree with adarsh


On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.com wrote:

 Sorry, its 6/6 and not 6/5,

 regds.

 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.com wrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the compiler.

 Even if you consider the normal way, as we(humans) percieve it, it will
 be evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread md shaukat ali
but i am confused in this problem...
int a=10;
int b;
b=--a--;
printf(%d %d,a,b);..what will output?

On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali ali.mdshau...@gmail.comwrote:

 agree with adarsh


 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.com wrote:

 Sorry, its 6/6 and not 6/5,

 regds.

 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.com wrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the compiler.

 Even if you consider the normal way, as we(humans) percieve it, it will
 be evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread ashish jain
I think it should output:
9 9

On Sun, Jul 8, 2012 at 11:42 PM, md shaukat ali ali.mdshau...@gmail.comwrote:

 but i am confused in this problem...
 int a=10;
 int b;
 b=--a--;
 printf(%d %d,a,b);..what will output?


 On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali 
 ali.mdshau...@gmail.comwrote:

 agree with adarsh


 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.com wrote:

 Sorry, its 6/6 and not 6/5,

 regds.

 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.comwrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the compiler.

 Even if you consider the normal way, as we(humans) percieve it, it will
 be evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread vindhya chhabra
.i think there will be an error in this -l value required, as post
increment has more precedence than pre increment

On Sun, Jul 8, 2012 at 11:44 PM, ashish jain ashishjainco...@gmail.comwrote:

 I think it should output:
 9 9


 On Sun, Jul 8, 2012 at 11:42 PM, md shaukat ali 
 ali.mdshau...@gmail.comwrote:

 but i am confused in this problem...
 int a=10;
 int b;
 b=--a--;
 printf(%d %d,a,b);..what will output?


 On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali 
 ali.mdshau...@gmail.comwrote:

 agree with adarsh


 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.comwrote:

 Sorry, its 6/6 and not 6/5,

 regds.

 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.comwrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the compiler.

 Even if you consider the normal way, as we(humans) percieve it, it
 will be evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.com
  wrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Vindhya Chhabra

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread vindhya chhabra
int a=10;
int b;
b=--a--;
printf(%d %d,a,b);. l value error in this ques..

On Sun, Jul 8, 2012 at 11:48 PM, vindhya chhabra
vindhyachha...@gmail.comwrote:

 .i think there will be an error in this -l value required, as post
 increment has more precedence than pre increment


 On Sun, Jul 8, 2012 at 11:44 PM, ashish jain ashishjainco...@gmail.comwrote:

 I think it should output:
 9 9


 On Sun, Jul 8, 2012 at 11:42 PM, md shaukat ali 
 ali.mdshau...@gmail.comwrote:

 but i am confused in this problem...
 int a=10;
 int b;
 b=--a--;
 printf(%d %d,a,b);..what will output?


 On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali ali.mdshau...@gmail.com
  wrote:

 agree with adarsh


 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.comwrote:

 Sorry, its 6/6 and not 6/5,

 regds.

 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar algog...@gmail.comwrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the 
 compiler.

 Even if you consider the normal way, as we(humans) percieve it, it
 will be evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Vindhya Chhabra






-- 
Vindhya Chhabra

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread atul anand
b=--a--; this will result into compiler error because 1st the post
decrement will occur and value will be saved in a temp variable . but
you cannot apply pre decrement on temp variable.

On 7/8/12, vindhya chhabra vindhyachha...@gmail.com wrote:
 int a=10;
 int b;
 b=--a--;
 printf(%d %d,a,b);. l value error in this ques..

 On Sun, Jul 8, 2012 at 11:48 PM, vindhya chhabra
 vindhyachha...@gmail.comwrote:

 .i think there will be an error in this -l value required, as post
 increment has more precedence than pre increment


 On Sun, Jul 8, 2012 at 11:44 PM, ashish jain
 ashishjainco...@gmail.comwrote:

 I think it should output:
 9 9


 On Sun, Jul 8, 2012 at 11:42 PM, md shaukat ali
 ali.mdshau...@gmail.comwrote:

 but i am confused in this problem...
 int a=10;
 int b;
 b=--a--;
 printf(%d %d,a,b);..what will output?


 On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali
 ali.mdshau...@gmail.com
  wrote:

 agree with adarsh


 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar
 algog...@gmail.comwrote:

 Sorry, its 6/6 and not 6/5,

 regds.

 On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar
 algog...@gmail.comwrote:

 Firstly, this is ambiguous and expressions with multiple
 increment/decrement operators will get executed according to the
 compiler.

 Even if you consider the normal way, as we(humans) percieve it, it
 will be evaluated as
 (++i)/(i++), which is 6/5, which is 1.

 Simple!



 On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Vindhya Chhabra






 --
 Vindhya Chhabra

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread md shaukat ali
then atul what would be the output of this prob...
int a=10;
int b=a++*a--;
prinf (%d,b);
On Sun, Jul 8, 2012 at 11:52 PM, atul anand atul.87fri...@gmail.com wrote:

 b=--a--; this will result into compiler error because 1st the post
 decrement will occur and value will be saved in a temp variable . but
 you cannot apply pre decrement on temp variable.

 On 7/8/12, vindhya chhabra vindhyachha...@gmail.com wrote:
  int a=10;
  int b;
  b=--a--;
  printf(%d %d,a,b);. l value error in this ques..
 
  On Sun, Jul 8, 2012 at 11:48 PM, vindhya chhabra
  vindhyachha...@gmail.comwrote:
 
  .i think there will be an error in this -l value required, as post
  increment has more precedence than pre increment
 
 
  On Sun, Jul 8, 2012 at 11:44 PM, ashish jain
  ashishjainco...@gmail.comwrote:
 
  I think it should output:
  9 9
 
 
  On Sun, Jul 8, 2012 at 11:42 PM, md shaukat ali
  ali.mdshau...@gmail.comwrote:
 
  but i am confused in this problem...
  int a=10;
  int b;
  b=--a--;
  printf(%d %d,a,b);..what will output?
 
 
  On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali
  ali.mdshau...@gmail.com
   wrote:
 
  agree with adarsh
 
 
  On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar
  algog...@gmail.comwrote:
 
  Sorry, its 6/6 and not 6/5,
 
  regds.
 
  On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar
  algog...@gmail.comwrote:
 
  Firstly, this is ambiguous and expressions with multiple
  increment/decrement operators will get executed according to the
  compiler.
 
  Even if you consider the normal way, as we(humans) percieve it, it
  will be evaluated as
  (++i)/(i++), which is 6/5, which is 1.
 
  Simple!
 
 
 
  On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
  rahul23111...@gmail.com wrote:
 
  int i=5;
  i=++i/i++;
  print i;
 
 
  i=1
 
  how?
 
  --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
   --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
   --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
   --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Vindhya Chhabra
 
 
 
 
 
 
  --
  Vindhya Chhabra
 
  --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread atul anand
it violates sequence pt. rule..so output is compiler dependent , but
as there is Lvalue error it would compile fine.
but in prev case pre  decrement expects Lvalue but has r-value instead
bcoz of the post increment.


On 7/9/12, md shaukat ali ali.mdshau...@gmail.com wrote:
 then atul what would be the output of this prob...
 int a=10;
 int b=a++*a--;
 prinf (%d,b);
 On Sun, Jul 8, 2012 at 11:52 PM, atul anand atul.87fri...@gmail.com
 wrote:

 b=--a--; this will result into compiler error because 1st the post
 decrement will occur and value will be saved in a temp variable . but
 you cannot apply pre decrement on temp variable.

 On 7/8/12, vindhya chhabra vindhyachha...@gmail.com wrote:
  int a=10;
  int b;
  b=--a--;
  printf(%d %d,a,b);. l value error in this ques..
 
  On Sun, Jul 8, 2012 at 11:48 PM, vindhya chhabra
  vindhyachha...@gmail.comwrote:
 
  .i think there will be an error in this -l value required, as post
  increment has more precedence than pre increment
 
 
  On Sun, Jul 8, 2012 at 11:44 PM, ashish jain
  ashishjainco...@gmail.comwrote:
 
  I think it should output:
  9 9
 
 
  On Sun, Jul 8, 2012 at 11:42 PM, md shaukat ali
  ali.mdshau...@gmail.comwrote:
 
  but i am confused in this problem...
  int a=10;
  int b;
  b=--a--;
  printf(%d %d,a,b);..what will output?
 
 
  On Sun, Jul 8, 2012 at 11:39 PM, md shaukat ali
  ali.mdshau...@gmail.com
   wrote:
 
  agree with adarsh
 
 
  On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar
  algog...@gmail.comwrote:
 
  Sorry, its 6/6 and not 6/5,
 
  regds.
 
  On Sun, Jul 8, 2012 at 10:39 PM, adarsh kumar
  algog...@gmail.comwrote:
 
  Firstly, this is ambiguous and expressions with multiple
  increment/decrement operators will get executed according to the
  compiler.
 
  Even if you consider the normal way, as we(humans) percieve it,
  it
  will be evaluated as
  (++i)/(i++), which is 6/5, which is 1.
 
  Simple!
 
 
 
  On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma 
  rahul23111...@gmail.com wrote:
 
  int i=5;
  i=++i/i++;
  print i;
 
 
  i=1
 
  how?
 
  --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
   --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
   --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
   --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Vindhya Chhabra
 
 
 
 
 
 
  --
  Vindhya Chhabra
 
  --
  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, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p

2012-07-08 Thread mitaksh gupta
the o/p will be 2 not 1 because of the post-increment operator.

On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:

 int i=5;
 i=++i/i++;
 print i;


 i=1

 how?

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C o/p help

2012-01-26 Thread rahul sharma
#includestdio.h
#includeconio.h
void fun(char **);

int main()
{
char *argv[]={ab,cd,de,fg};
fun(argv);
getch();
return 0;
}

void fun(char **p)
{
 char *t;
 t=(p+=sizeof(int))[-1];
 printf(%s\n,t);
}

o/p: fg

can nyone xplain

the 2nd statement in fun?

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p help

2012-01-26 Thread atul anand
output depends on sizeof(int)so it may be different if you run on
different compilers.

considering *sizeof(int) = 2;*

argv[] is array of pointers.
  (p+=sizeof(int))[-1];
p=p+2 // 2=sizeof(int);

now p will be pointing at index *argv[2];
then you are doing

p=p-1;

i.e p will point to *argv[1]

hence output will be
o/p = cd

On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma rahul23111...@gmail.comwrote:

 #includestdio.h
 #includeconio.h
 void fun(char **);

 int main()
 {
 char *argv[]={ab,cd,de,fg};
 fun(argv);
 getch();
 return 0;
 }

 void fun(char **p)
 {
  char *t;
  t=(p+=sizeof(int))[-1];
  printf(%s\n,t);
 }

 o/p: fg

 can nyone xplain

 the 2nd statement in fun?

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p help

2012-01-26 Thread atul anand
btw your compiler has sizeof(int)=4;
thats why o/p = fg

On Thu, Jan 26, 2012 at 11:09 PM, atul anand atul.87fri...@gmail.comwrote:

 output depends on sizeof(int)so it may be different if you run on
 different compilers.

 considering *sizeof(int) = 2;*

 argv[] is array of pointers.
   (p+=sizeof(int))[-1];
 p=p+2 // 2=sizeof(int);

 now p will be pointing at index *argv[2];
 then you are doing

 p=p-1;

 i.e p will point to *argv[1]

 hence output will be
 o/p = cd

 On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma rahul23111...@gmail.comwrote:

 #includestdio.h
 #includeconio.h
 void fun(char **);

 int main()
 {
 char *argv[]={ab,cd,de,fg};
 fun(argv);
 getch();
 return 0;
 }

 void fun(char **p)
 {
  char *t;
  t=(p+=sizeof(int))[-1];
  printf(%s\n,t);
 }

 o/p: fg

 can nyone xplain

 the 2nd statement in fun?

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p help

2012-01-26 Thread rahul sharma
[-1] in end is same as -1 ??

On Thu, Jan 26, 2012 at 11:11 PM, atul anand atul.87fri...@gmail.comwrote:

 btw your compiler has sizeof(int)=4;
 thats why o/p = fg

 On Thu, Jan 26, 2012 at 11:09 PM, atul anand atul.87fri...@gmail.comwrote:

 output depends on sizeof(int)so it may be different if you run on
 different compilers.

 considering *sizeof(int) = 2;*

 argv[] is array of pointers.
   (p+=sizeof(int))[-1];
 p=p+2 // 2=sizeof(int);

 now p will be pointing at index *argv[2];
 then you are doing

 p=p-1;

 i.e p will point to *argv[1]

 hence output will be
 o/p = cd

 On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 #includestdio.h
 #includeconio.h
 void fun(char **);

 int main()
 {
 char *argv[]={ab,cd,de,fg};
 fun(argv);
 getch();
 return 0;
 }

 void fun(char **p)
 {
  char *t;
  t=(p+=sizeof(int))[-1];
  printf(%s\n,t);
 }

 o/p: fg

 can nyone xplain

 the 2nd statement in fun?

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p help

2012-01-26 Thread atul anand
think in terms of pointers...

they are same :-

p[-1] = *(p - 1)

On Thu, Jan 26, 2012 at 11:15 PM, rahul sharma rahul23111...@gmail.comwrote:

 [-1] in end is same as -1 ??


 On Thu, Jan 26, 2012 at 11:11 PM, atul anand atul.87fri...@gmail.comwrote:

 btw your compiler has sizeof(int)=4;
 thats why o/p = fg

 On Thu, Jan 26, 2012 at 11:09 PM, atul anand atul.87fri...@gmail.comwrote:

 output depends on sizeof(int)so it may be different if you run on
 different compilers.

 considering *sizeof(int) = 2;*

 argv[] is array of pointers.
   (p+=sizeof(int))[-1];
 p=p+2 // 2=sizeof(int);

 now p will be pointing at index *argv[2];
 then you are doing

 p=p-1;

 i.e p will point to *argv[1]

 hence output will be
 o/p = cd

 On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 #includestdio.h
 #includeconio.h
 void fun(char **);

 int main()
 {
 char *argv[]={ab,cd,de,fg};
 fun(argv);
 getch();
 return 0;
 }

 void fun(char **p)
 {
  char *t;
  t=(p+=sizeof(int))[-1];
  printf(%s\n,t);
 }

 o/p: fg

 can nyone xplain

 the 2nd statement in fun?

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p help

2012-01-26 Thread rahul sharma
@ atul...got nw..thnx

On Thu, Jan 26, 2012 at 11:26 PM, atul anand atul.87fri...@gmail.comwrote:

 think in terms of pointers...

 they are same :-

 p[-1] = *(p - 1)


 On Thu, Jan 26, 2012 at 11:15 PM, rahul sharma rahul23111...@gmail.comwrote:

 [-1] in end is same as -1 ??


 On Thu, Jan 26, 2012 at 11:11 PM, atul anand atul.87fri...@gmail.comwrote:

 btw your compiler has sizeof(int)=4;
 thats why o/p = fg

 On Thu, Jan 26, 2012 at 11:09 PM, atul anand atul.87fri...@gmail.comwrote:

 output depends on sizeof(int)so it may be different if you run on
 different compilers.

 considering *sizeof(int) = 2;*

 argv[] is array of pointers.
   (p+=sizeof(int))[-1];
 p=p+2 // 2=sizeof(int);

 now p will be pointing at index *argv[2];
 then you are doing

 p=p-1;

 i.e p will point to *argv[1]

 hence output will be
 o/p = cd

 On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma rahul23111...@gmail.com
  wrote:

 #includestdio.h
 #includeconio.h
 void fun(char **);

 int main()
 {
 char *argv[]={ab,cd,de,fg};
 fun(argv);
 getch();
 return 0;
 }

 void fun(char **p)
 {
  char *t;
  t=(p+=sizeof(int))[-1];
  printf(%s\n,t);
 }

 o/p: fg

 can nyone xplain

 the 2nd statement in fun?

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C o/p gud one try

2011-03-28 Thread ArPiT BhAtNaGaR
#includestdio.h
main()
{
long x;
float t;
scanf(%f,t);
printf(%d\n,t);
x=90;
printf(%f\n,x);
{
x=1;
printf(%f\n,x);
{
x=30;
printf(%f\n,x);
}
printf(%f\n,x);
}
x==9;
printf(%f\n,x);

}

o/p on gcc compiler
20.3   (i/p given)
-1073741824
20.299988
20.299988
20.299988
20.299988
20.299988

plz explain the o/p

-- 
Arpit Bhatnagar
(MNIT JAIPUR)

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.