Re: [algogeeks] C doubt

2012-10-06 Thread atul anand
ch=i++[s]; // in this value is assigned first and then increment will
take place...bcozz you are using post increment.
here i does not have any other option it has to do post increment
before [] comes...but it will not assign value to 'i' ( i.e
incremented 'i' value)
so compiler will do something like this
ch=*(i + s);
i=i+1;

ch=++i[s]; // in this case compiler will rewrite it to something like this ,
ch=++(*(i+s)); // this will increment the value at i[s], pre-increment
is taking place ...so updated i[s] value will be assigned o ch

if you do somthing like this :-
ch=i[s]++; // here post increment is happening , so compiler will
rewrite it somthing like this

// ch will contain old value but if you print i[s] , it will print
incremented value of i[s];
ch=*(i+s);
i[s]=i[s] + 1;


On 10/6/12, rahul sharma  wrote:
> char ch
> ch=i++[s];
>
> printf("%c",ch);  this will print i[s],then i is incrementrd after
> assigning to ch
>
>
> ch=++i[s];// this will inccrement value at i[s]
>
>
> My question is what is role of priority which is making them behaving
> differentI am not getting  y not first i is incremented then i[s] is
> assigned
> 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.
>
>

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

2012-10-06 Thread rahul sharma
char ch
ch=i++[s];

printf("%c",ch);  this will print i[s],then i is incrementrd after
assigning to ch


ch=++i[s];// this will inccrement value at i[s]


My question is what is role of priority which is making them behaving
differentI am not getting  y not first i is incremented then i[s] is
assigned
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 doubt show me how smart u guys are

2011-09-25 Thread Jasveen Singh
yes i can do that but how do u want me to proceed if u can give me the code
to tell me how to fetch data from the file and use bucket sort on it
it will be a huge favour and am i right at my approach to use 2d array to
store the values
plz tell me sir plz!!

On Sun, Sep 25, 2011 at 1:08 PM, Ashima .  wrote:

> use radix sort 4 times. using bucket sort with chaining as the sorting
> algorithm.
> time complexity= O(4(n+k))
> space complexity = O(n)
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Sun, Sep 25, 2011 at 6:01 AM, Jasveen Singh 
> wrote:
>
>> i have a file 'star.txt' containing recordss in the form name score as
>> given below
>> *name   score*
>> dave   52.67
>> steve60.09
>>
>> and so on till 64 names
>>
>> i have to make a program to read and sort these names in a rank
>> just show not to store
>> all scores are in float and need to rank these names in a
>> orderconsider these all students and teacher
>> need a program to rank their percentage in an order to announce ranks
>> lets see some algogeek magic
>> what i did was
>> create a static 2D array of 100 elements and store data from file in it
>> using file handling(obvious)
>> and then use a simple for loop ranking on 2nd line of array
>>
>> please need help guys
>>
>> --
>> 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 doubt show me how smart u guys are

2011-09-25 Thread Ashima .
use radix sort 4 times. using bucket sort with chaining as the sorting
algorithm.
time complexity= O(4(n+k))
space complexity = O(n)
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Sun, Sep 25, 2011 at 6:01 AM, Jasveen Singh wrote:

> i have a file 'star.txt' containing recordss in the form name score as
> given below
> *name   score*
> dave   52.67
> steve60.09
>
> and so on till 64 names
>
> i have to make a program to read and sort these names in a rank
> just show not to store
> all scores are in float and need to rank these names in a
> orderconsider these all students and teacher
> need a program to rank their percentage in an order to announce ranks
> lets see some algogeek magic
> what i did was
> create a static 2D array of 100 elements and store data from file in it
> using file handling(obvious)
> and then use a simple for loop ranking on 2nd line of array
>
> please need help guys
>
> --
> 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 doubt show me how smart u guys are

2011-09-24 Thread Jasveen Singh
i have a file 'star.txt' containing recordss in the form name score as given
below
*name   score*
dave   52.67
steve60.09

and so on till 64 names

i have to make a program to read and sort these names in a rank
just show not to store
all scores are in float and need to rank these names in a
orderconsider these all students and teacher
need a program to rank their percentage in an order to announce ranks
lets see some algogeek magic
what i did was
create a static 2D array of 100 elements and store data from file in it
using file handling(obvious)
and then use a simple for loop ranking on 2nd line of array

please need help guys

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

2011-08-31 Thread kartik sachan
becoz int is of 4btyes so 32 bits required

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

2011-08-31 Thread annarao kataru
why it(total) should be a multiple of 32  bits..can u clarify it?

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

2011-08-31 Thread Kunal Patil
@kartik:
typedef struct
{
int bit1:29;
int bit2:4;
}bit;
This makes total number of bits 33, which is not on int boundry. (multiple
of 32 bits)
So to make it aligned on int boundry, 31 extra bits  are padded at the end
of bit2.
This makes size of struct 29 + 4 + 31 = 64 bits --> 8 bytes.
When bit1 + bit2 = multiple of 32, No need for alignment arises.

Similar example is
struct{
   int x;
   char y;
   }temp;
Here int --> 32 bits
char --> 8 bits
Total = 40 bits. Not a multiple of 32 bits thus, it is forcefully aligned
along int boundary by padding 24 bits.
If you are confused about all this, Google padding in struct.

On Wed, Aug 31, 2011 at 10:34 PM, kartik sachan wrote:

> @ prateek i am still not geeting why now out put is 4
> but if we change second bit2:5 then out put again 8
> plzz explain throughly
>
>  --
> 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 doubt

2011-08-31 Thread kartik sachan
@ prateek i am still not geeting why now out put is 4
but if we change second bit2:5 then out put again 8
plzz explain throughly

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

2011-08-31 Thread Sanjay Rajpal
The result will depend on alignment : byte alignment or Word alignment.


Sanju
:)



On Wed, Aug 31, 2011 at 2:51 AM, PRATEEK VERMA  wrote:

> oh i'm sorry guys & galz,its my mistake..actually i forgot to add one
> more field in struct
> this is the correct one
> typedef struct
> {
> int bit1:29;
> int bit2:4;
>
> }bit;
> int main()
> {
> printf("%d\n",sizeof(bit));
> return 0;
> }
>
> now what will be the output...i'm sure you will amazed to see the
> result after changing bitfield of bit1 to 28.
>
>
> --
> 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 doubt

2011-08-31 Thread PRATEEK VERMA
oh i'm sorry guys & galz,its my mistake..actually i forgot to add one
more field in struct
this is the correct one
typedef struct
{
int bit1:29;
int bit2:4;
}bit;
int main()
{
printf("%d\n",sizeof(bit));
return 0;
}

now what will be the output...i'm sure you will amazed to see the result
after changing bitfield of bit1 to 28.

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

2011-08-30 Thread kartik sachan
@prateek check this i have complied on ideone
http://ideone.com/UV7MG
output is 4 only

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

2011-08-30 Thread Kamakshii Aggarwal
@prateek:can u pls explain y the o/p will be 8??according to me also o/p
should be 4.

On Tue, Aug 30, 2011 at 11:42 PM, PRATEEK VERMA wrote:

> @kartik it's wrong output...output will be 8 bytes.I asked this question
> just to give more clear picture of bit field
>
>  --
> 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.
>



-- 
Regards,
Kamakshi
kamakshi...@gmail.com

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

2011-08-30 Thread PRATEEK VERMA
@kartik it's wrong output...output will be 8 bytes.I asked this question
just to give more clear picture of bit field

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

2011-08-29 Thread kartik sachan
@prateek obivously we are calculating size of struct so its output  is 4 (if
u consider int as 4 bytes)

what is the relation between this and above  question??

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

2011-08-28 Thread PRATEEK VERMA
@kartik
there is nothing to do as how computer stores the datasome may be
little endian or big endian.
only thing that matters here is how the bits are being accessed.
computer accesses the bits from left to right.
you can ensure by running the following code
main()
{
int r=456;
int *p;
p=&r;
printf("%d\n",*((char*)p));
}

one more thing

can u guess what will be output of
typedef struct
{
int bit1:32;
}bit;
int main()
{
printf("%d\n",sizeof(bit));
}
and why??

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

2011-08-28 Thread manish patel
it will be 00.

Bit fields are allocated within an integer from least-significant to
most-significant bit. In the following code

struct mybitfields
{
unsigned short a : 4;
unsigned short b : 5;
unsigned short c : 7;
} test;

int main( void );
{
test.a = 2;
test.b = 31;
test.c = 0;
}

the bits would be arranged as follows:

0001 0010
cccb 



On Mon, Aug 29, 2011 at 10:31 AM, kartik sachan wrote:

> @PRATEEK if i make int bit1:2 then it will store 2 bytes
> for example if bit1=4;then out will be 0 or 1
> my question is  it storing number from least significant bit or most
> significant bit???
> suppose for 4 0100 so out will be 00 or 01??
>
>  --
> 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.
>



-- 
With Regards

Manish Patel
BTech
Computer Science And Engineering
National Institute of Technology -Allahabad

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

2011-08-28 Thread kartik sachan
u r changing readonly memory that's why segment error

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

2011-08-28 Thread kartik sachan
@PRATEEK if i make int bit1:2 then it will store 2 bytes
for example if bit1=4;then out will be 0 or 1
my question is  it storing number from least significant bit or most
significant bit???
suppose for 4 0100 so out will be 00 or 01??

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

2011-08-28 Thread rahul vatsa
wen u pass an array as parameter to a func, it does decay to a pointer,  nd
compiler doesn't stop u to change contents of the array through this
pointer.
basically u can change or not the value at some memory location depends on
how u have allocated it not how u r accessing it.

On Sun, Aug 28, 2011 at 7:47 AM, rohit  wrote:

> Thanks for your reply himanshu, ...I am aware of the above stated fact but
> my doubt is that when i pass this char array to a function and accept it as
> a char pointer (char *a), and then when write a[0] = 'a', why don't i get an
> error?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/uoEq0N1M1t0J.
>
> 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 doubt

2011-08-28 Thread himanshu kansal
because when u pass an array, the address of memory location that is recievd
in the func is accessible and write allowed also to u..so u dont get an
error

On Sun, Aug 28, 2011 at 5:17 PM, rohit  wrote:

> Thanks for your reply himanshu, ...I am aware of the above stated fact but
> my doubt is that when i pass this char array to a function and accept it as
> a char pointer (char *a), and then when write a[0] = 'a', why don't i get an
> error?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/uoEq0N1M1t0J.
>
> 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.
>



-- 

   Regards
 Himanshu Kansal
   Msc Comp. sc.
(University of Delhi)

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

2011-08-28 Thread Apoorve Mohan
@rohit: why do you think this should give error???

On Sun, Aug 28, 2011 at 5:17 PM, rohit  wrote:

> Thanks for your reply himanshu, ...I am aware of the above stated fact but
> my doubt is that when i pass this char array to a function and accept it as
> a char pointer (char *a), and then when write a[0] = 'a', why don't i get an
> error?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/uoEq0N1M1t0J.
>
> 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.
>



-- 
regards

Apoorve Mohan

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

2011-08-28 Thread rohit
Thanks for your reply himanshu, ...I am aware of the above stated fact but 
my doubt is that when i pass this char array to a function and accept it as 
a char pointer (char *a), and then when write a[0] = 'a', why don't i get an 
error?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/uoEq0N1M1t0J.
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 doubt

2011-08-28 Thread himanshu kansal
cz when u do char p[]="hello" compiler automatically allocates enough
memory(6 charc here) and puts your string there..

but whn u do char*a="hello" then its complr dependent where d string will be
storedsome compiler stores it in a special location in data segmnt whch
is (read only )so modifying the string is errorother compiler stores it
in write allowed memory so u can alter d string there...
On Sun, Aug 28, 2011 at 5:02 PM, rohit  wrote:

> Why does the following code not give an error?
>
> #include
> void fun(char *a) //array decays to pointer here
> {
>  a[0] = 'a';
>  printf("%s\n",a);
>
>
> }
> int main()
> {
> char p[]="hello";
> fun(p);
> getch();
> }
>
> if i write something like this in main
>
> char *arr="hello"
> arr[0] = 'r';  //this gives runtime error and i know why
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/rxboAmI8lEUJ.
> 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.
>



-- 

   Regards
 Himanshu Kansal
   Msc Comp. sc.
(University of Delhi)

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

2011-08-28 Thread rohit
Why does the following code not give an error?

#include
void fun(char *a) //array decays to pointer here
{ 
 a[0] = 'a'; 
 printf("%s\n",a); 
  

}
int main()
{
char p[]="hello";
fun(p);
getch();
}

if i write something like this in main

char *arr="hello"
arr[0] = 'r';  //this gives runtime error and i know why

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/rxboAmI8lEUJ.
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 doubt

2011-08-28 Thread PRATEEK VERMA
int bit1:1;
above definition instructs compiler that use 1 bit for storing
integer(signed by default) in bit1.
Such notation is used for optimization of memory use.

So if someone stores 1 in bit1 then,it will be treated as -1 by compiler
since we have instructed the compiler to store it in one bit and since in
this case leftmost bit is 1 which will be treated as -1 by the system and
output will be -1.

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

2011-08-28 Thread ravi maggon
class{
 int bit1:1;
}

please explain the meaning of line 2.

-- 

Regards
Ravi Maggon

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

2011-08-23 Thread Ankur Goel
u will be taking pointer in structure and use malloc to allocate memory for
the number of integer u need

On Wed, Aug 24, 2011 at 10:21 AM, Arun Vishwanathan
wrote:

> say that you have a structure with some fields of known size and unknown
> size.For example, a char, an integer and an integer array.I do not know the
> size of the integer array until the user mentions the number of bytes he
> needs this integer array to cover in the command line as an argument.Is it
> possible to have a structure with an integer dynamic array?
>
> Arun
>
> --
>  "People often say that motivation doesn't last. Well, neither does
> bathing - that's why we recommend it daily."
>
>  --
> 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 doubt

2011-08-23 Thread Arun Vishwanathan
say that you have a structure with some fields of known size and unknown
size.For example, a char, an integer and an integer array.I do not know the
size of the integer array until the user mentions the number of bytes he
needs this integer array to cover in the command line as an argument.Is it
possible to have a structure with an integer dynamic array?

Arun

-- 
 "People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily."

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

2011-08-11 Thread UTKARSH SRIVASTAV
#include
main()
{
  int a[10],i;
  int (*p)[10];
  p=&a;
  for( i=0;i<10;i++)
  {
   *((int *)p+i)=i;
  }
  for( i=0;i<10;i++)
  {
   printf(" %d",a[i]);
  }

}

-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

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

2011-08-11 Thread Algo Lover
Suppose i create a block of 10 ints, p is a pointer pointing to this
block.

int (*p)[10];

How can i initialize these 10 integer blocks using pointer p.

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

2011-08-08 Thread Debabrata Das
when you do maloc or new , space is allocated from heap segment of
your process address space.
Though you have alllocated (sizeof(struct abc) space but strcpy copies
"abcde" beyond your allocated space and overwrite the contents, we
should avoid this scenario and use strncpy so that it cannot go beyond
alloacted space.. you never know if some one using the buffer beyond
p.



On Mon, Aug 8, 2011 at 10:48 PM, Mohit Goel  wrote:
>
> @debabratas:   can u plz explain  this term ..heap corruption ..
>
> --
> 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 doubt

2011-08-08 Thread Mohit Goel
@debabratas:   can u plz explain  this term ..heap corruption ..

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

2011-08-08 Thread Debabrata Das
this is a case of heap corruption

On Mon, Aug 8, 2011 at 10:40 PM, Mohit Goel  wrote:
> #include
> #include
> struct abc
> {
>    char p[1];
> };
> int main()
> {
>     struct abc *c =NULL;
>  char name[]="abcde";
>  c = (struct abc *) malloc (sizeof(struct abc));
>
>  strcpy(c->p,name);
>  printf("%s",c->p);
>  getch();
>  return 0;
> }
> why it is printing the whole string "abcde"..there is not enough memory
> in array 'p'...
>
> --
> 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 doubt

2011-08-08 Thread Mohit Goel
#include
#include
struct abc
{
   char p[1];
};
int main()
{
struct abc *c =NULL;
 char name[]="abcde";
 c = (struct abc *) malloc (sizeof(struct abc));

 strcpy(c->p,name);
 printf("%s",c->p);
 getch();
 return 0;
}
why it is printing the whole string "abcde"..there is not enough memory
in array 'p'...

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

2011-08-04 Thread Shachindra A C
Hi All,

  In the code below, even though pD is actually pointing to a base
class object, how is the print function being successfully called?

#include

class base
{
public:
int BVal;
base()
{
BVal = 100;
}
};

class derived : public base
{
public:
derived()
{
DVal = 500;
}
void print()
{
std::cout<<"\nBVal ="<(&B);*
*pD->print();*
return 0;
}

-- 
Regards,
Shachindra A C

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

2011-07-31 Thread Tyler Durden
How do we declare an array of N pointers to functions that return int??

An array of N pointers to integers is this:  int *p[N]
Just can't figure out the case for pointers to function

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/5jW04MciOgQJ.
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 doubt!

2011-07-25 Thread Nitish Garg
My bad! Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/kiSipxeFkwAJ.
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 doubt!

2011-07-25 Thread Neeraj Gupta
On Tue, Jul 26, 2011 at 1:43 AM, Nitish Garg wrote:

> This following code produces output as 8 4 4.
>
> 8 is fine, as the size of an int plus a pointer is 8, but why the size of p 
> and q is being shown as 4?
>
> #include#includeint main(){
> struct node
> {
>int data;
>struct node * link;
> };
> struct node *p, *q;
> printf("%d ", sizeof(struct node));
>
>
> p = (struct node *)calloc(sizeof(struct node) , 1);
> q = (struct node *)calloc(sizeof(struct node) , 1);
> printf("%d %d", sizeof(p), sizeof(q));
> getchar();}
>
> because p and q are pointers. Note an object.

>  You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/8bw2jFtQHBsJ.
> 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 doubt!

2011-07-25 Thread aditi garg
u hv answered ur ques in ur ques itself...:)
c u understand size of struct node as 4+4=8 rite?? now in this 4 is size of
int and 4 is the size of the pointer of the type struct node...
now wat are p and q? dey are also pointers to struct node jst like
link...now whn u understand dat the size of link is 4 thn u shudnt have any
trouble understanding p and q as well...
I hope im clear..:)

On Tue, Jul 26, 2011 at 1:43 AM, Nitish Garg wrote:

> This following code produces output as 8 4 4.
>
> 8 is fine, as the size of an int plus a pointer is 8, but why the size of p 
> and q is being shown as 4?
>
> #include#includeint main(){
> struct node
> {
>int data;
>struct node * link;
> };
> struct node *p, *q;
> printf("%d ", sizeof(struct node));
> p = (struct node *)calloc(sizeof(struct node) , 1);
> q = (struct node *)calloc(sizeof(struct node) , 1);
> printf("%d %d", sizeof(p), sizeof(q));
> getchar();}
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/8bw2jFtQHBsJ.
> 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

9718388816

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

2011-07-25 Thread Nitish Garg


This following code produces output as 8 4 4.

8 is fine, as the size of an int plus a pointer is 8, but why the size of p and 
q is being shown as 4?

#include#includeint main(){
struct node
{
   int data;
   struct node * link;   
};
struct node *p, *q;
printf("%d ", sizeof(struct node));
p = (struct node *)calloc(sizeof(struct node) , 1);
q = (struct node *)calloc(sizeof(struct node) , 1);
printf("%d %d", sizeof(p), sizeof(q));
getchar();}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/8bw2jFtQHBsJ.
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 doubt

2011-07-14 Thread sangeeta goyal
thnx all...i  got it  :)

On Thu, Jul 14, 2011 at 2:13 AM, Anika Jain  wrote:

> As in base 10 we say 552.5 is same as 5.525 *10^2 , here 2 is the exponent
> of base 10.. so similarly in binary nos. for base 2 here if i make
> 101.00110011..  to 1.0100110011.. *2^2 my exponent is 2.. now in storage of
> floats exponent is stored as exponent +127 i.e here 2 +127 so we get
> 1001
>
> On Thu, Jul 14, 2011 at 2:03 AM, Kamakshii Aggarwal  > wrote:
>
>> @anika:can u please explain the meaning of this line..
>> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
>> exponent is stored as 127+exponent so here it becomes 1001..
>>
>>
>> On Wed, Jul 13, 2011 at 11:44 PM, Piyush Kapoor wrote:
>>
>>> thanks,i hv just entered 2nd year,so most probably i will study this
>>> year
>>>  --
>>> *Regards,*
>>> *Piyush Kapoor,*
>>> *CSE-IT-BHU*
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> Regards,
>> Kamakshi
>> kamakshi...@gmail.com
>>
>> --
>> 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 doubt

2011-07-13 Thread Anika Jain
As in base 10 we say 552.5 is same as 5.525 *10^2 , here 2 is the exponent
of base 10.. so similarly in binary nos. for base 2 here if i make
101.00110011..  to 1.0100110011.. *2^2 my exponent is 2.. now in storage of
floats exponent is stored as exponent +127 i.e here 2 +127 so we get
1001

On Thu, Jul 14, 2011 at 2:03 AM, Kamakshii Aggarwal
wrote:

> @anika:can u please explain the meaning of this line..
> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
> exponent is stored as 127+exponent so here it becomes 1001..
>
>
> On Wed, Jul 13, 2011 at 11:44 PM, Piyush Kapoor wrote:
>
>> thanks,i hv just entered 2nd year,so most probably i will study this
>> year
>> --
>> *Regards,*
>> *Piyush Kapoor,*
>> *CSE-IT-BHU*
>>
>>  --
>> 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.
>>
>
>
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
> --
> 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 doubt

2011-07-13 Thread Kamakshii Aggarwal
@anika:can u please explain the meaning of this line..
so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
exponent is stored as 127+exponent so here it becomes 1001..


On Wed, Jul 13, 2011 at 11:44 PM, Piyush Kapoor  wrote:

> thanks,i hv just entered 2nd year,so most probably i will study this
> year
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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.
>



-- 
Regards,
Kamakshi
kamakshi...@gmail.com

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

2011-07-13 Thread Piyush Kapoor
thanks,i hv just entered 2nd year,so most probably i will study this
year
-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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

2011-07-13 Thread Sunny T
computer organization carl hamacher. computer system architecture by Morris
Mano. Computer organization and architecture by william stallings.. if u
dont have these refer wikipedia.

On Wed, Jul 13, 2011 at 10:59 PM, Piyush Kapoor  wrote:

> Will u guyz pls tell me frm where do u study terms like "endian" ,it is a
> pity i had to google it  :( :(
>
>
> On Wed, Jul 13, 2011 at 10:30 PM, Anika Jain wrote:
>
>> ya thts ryt, for big endian it will be 64 -90 102 102
>>
>>
>> On Wed, Jul 13, 2011 at 10:22 PM, sunny agrawal 
>> wrote:
>>
>>> I think it is machine dependent and current output is for a little endian
>>> machine
>>> and output should be reverse for a big endian machine
>>>
>>> On Wed, Jul 13, 2011 at 10:18 PM, Anika Jain wrote:
>>>
 it is not unsigned its signed but positive thts y it is 0..
 the order isnt reversed.. look at the code, the code 1st prints lowest
 order byte then next and then next and then highest soo output is 102 102
 -90 64


 On Wed, Jul 13, 2011 at 8:08 PM, Piyush Kapoor wrote:

> why is the order of numbers reversed?
>
>
> On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain wrote:
>
>> sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit
>> is 0
>>
>>
>> On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor 
>> wrote:
>>
>>> Shouldn't the value of "1100" be -64
>>>
>>>
>>> On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain 
>>> wrote:
>>>
 binary equivalent of 5.2 is
 101.0011001100110011001100110011(nonterminating)..

 now it is actually stored in normalised frorm in 32 bits..
 like this
 <--1 bit for sign---><-8 bits for exponent-><23 bits
 for fraction-->
 this is from higher order byte to lower order for little endian..

 if no. is positive sign bit is 0 else it is 1

 The rule says change your floating point no. in such a form that
 after 1st digit that is 1 decimal point comes sooo
 here it becomes like
 1.0100110011001100110011001100110011(nonterminating) * 2^2

 so i here get an exponent of 2 as 2 here.. now in exponent 8 bits
 this exponent is stored as 127+exponent so here it becomes 1001..

 now fraction here is clearly value after the decimal point i.e.
 01001100110011001100110011001100110011(non terminationg) but only 1st 
 23
 bits are saved rest are left

 so finally wht we get is:

 1100 10100110 01100110 01100110
 (64)  (-90) (102)(102)



 On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor >>> > wrote:

> why do we need a NthIntWithKBits() in this topic?
>
>
> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . <
> jatka.oppimi...@gmail.com> wrote:
>
>>
>>
>> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor <
>> pkjee2...@gmail.com> wrote:
>>
>>> Can anybody give a full explanation
>>>
>>> http://ideone.com/K1QmV
>>
>>>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
>>> sunny816.i...@gmail.com> wrote:
>>>
 try to find out the binary representation of float value 5.2


 On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta <
 sangeeta15...@gmail.com> wrote:

> int main(){
> int i;
> float a=5.2;
> char *ptr;
> ptr=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%d ",*ptr++);
> }
>
> output:
>  102 102 -90 64.explain?
>
> --
> 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.
>
>


 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee


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

Re: [algogeeks] c doubt

2011-07-13 Thread Piyush Kapoor
Will u guyz pls tell me frm where do u study terms like "endian" ,it is a
pity i had to google it  :( :(

On Wed, Jul 13, 2011 at 10:30 PM, Anika Jain  wrote:

> ya thts ryt, for big endian it will be 64 -90 102 102
>
>
> On Wed, Jul 13, 2011 at 10:22 PM, sunny agrawal 
> wrote:
>
>> I think it is machine dependent and current output is for a little endian
>> machine
>> and output should be reverse for a big endian machine
>>
>> On Wed, Jul 13, 2011 at 10:18 PM, Anika Jain wrote:
>>
>>> it is not unsigned its signed but positive thts y it is 0..
>>> the order isnt reversed.. look at the code, the code 1st prints lowest
>>> order byte then next and then next and then highest soo output is 102 102
>>> -90 64
>>>
>>>
>>> On Wed, Jul 13, 2011 at 8:08 PM, Piyush Kapoor wrote:
>>>
 why is the order of numbers reversed?


 On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain wrote:

> sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit
> is 0
>
>
> On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor wrote:
>
>> Shouldn't the value of "1100" be -64
>>
>>
>> On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain 
>> wrote:
>>
>>> binary equivalent of 5.2 is
>>> 101.0011001100110011001100110011(nonterminating)..
>>>
>>> now it is actually stored in normalised frorm in 32 bits..
>>> like this
>>> <--1 bit for sign---><-8 bits for exponent-><23 bits
>>> for fraction-->
>>> this is from higher order byte to lower order for little endian..
>>>
>>> if no. is positive sign bit is 0 else it is 1
>>>
>>> The rule says change your floating point no. in such a form that
>>> after 1st digit that is 1 decimal point comes sooo
>>> here it becomes like
>>> 1.0100110011001100110011001100110011(nonterminating) * 2^2
>>>
>>> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits
>>> this exponent is stored as 127+exponent so here it becomes 1001..
>>>
>>> now fraction here is clearly value after the decimal point i.e.
>>> 01001100110011001100110011001100110011(non terminationg) but only 1st 23
>>> bits are saved rest are left
>>>
>>> so finally wht we get is:
>>>
>>> 1100 10100110 01100110 01100110
>>> (64)  (-90) (102)(102)
>>>
>>>
>>>
>>> On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor 
>>> wrote:
>>>
 why do we need a NthIntWithKBits() in this topic?


 On Tue, Jul 12, 2011 at 7:58 AM, oppilas . <
 jatka.oppimi...@gmail.com> wrote:

>
>
> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor <
> pkjee2...@gmail.com> wrote:
>
>> Can anybody give a full explanation
>>
>> http://ideone.com/K1QmV
>
>>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
>> sunny816.i...@gmail.com> wrote:
>>
>>> try to find out the binary representation of float value 5.2
>>>
>>>
>>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta <
>>> sangeeta15...@gmail.com> wrote:
>>>
 int main(){
 int i;
 float a=5.2;
 char *ptr;
 ptr=(char *)&a;
 for(i=0;i<=3;i++)
 printf("%d ",*ptr++);
 }

 output:
  102 102 -90 64.explain?

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


>>>
>>>
>>> --
>>> Sunny Aggrawal
>>> B-Tech IV year,CSI
>>> Indian Institute Of Technology,Roorkee
>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> *Regards,*
>> *Piyush Kapoor,*
>> *CSE-IT-BHU*
>>
>>  --
>> 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, sen

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
ya thts ryt, for big endian it will be 64 -90 102 102

On Wed, Jul 13, 2011 at 10:22 PM, sunny agrawal wrote:

> I think it is machine dependent and current output is for a little endian
> machine
> and output should be reverse for a big endian machine
>
> On Wed, Jul 13, 2011 at 10:18 PM, Anika Jain wrote:
>
>> it is not unsigned its signed but positive thts y it is 0..
>> the order isnt reversed.. look at the code, the code 1st prints lowest
>> order byte then next and then next and then highest soo output is 102 102
>> -90 64
>>
>>
>> On Wed, Jul 13, 2011 at 8:08 PM, Piyush Kapoor wrote:
>>
>>> why is the order of numbers reversed?
>>>
>>>
>>> On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain wrote:
>>>
 sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is
 0


 On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor wrote:

> Shouldn't the value of "1100" be -64
>
>
> On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain wrote:
>
>> binary equivalent of 5.2 is
>> 101.0011001100110011001100110011(nonterminating)..
>>
>> now it is actually stored in normalised frorm in 32 bits..
>> like this
>> <--1 bit for sign---><-8 bits for exponent-><23 bits
>> for fraction-->
>> this is from higher order byte to lower order for little endian..
>>
>> if no. is positive sign bit is 0 else it is 1
>>
>> The rule says change your floating point no. in such a form that after
>> 1st digit that is 1 decimal point comes sooo
>> here it becomes like
>> 1.0100110011001100110011001100110011(nonterminating) * 2^2
>>
>> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
>> exponent is stored as 127+exponent so here it becomes 1001..
>>
>> now fraction here is clearly value after the decimal point i.e.
>> 01001100110011001100110011001100110011(non terminationg) but only 1st 23
>> bits are saved rest are left
>>
>> so finally wht we get is:
>>
>> 1100 10100110 01100110 01100110
>> (64)  (-90) (102)(102)
>>
>>
>>
>> On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor 
>> wrote:
>>
>>> why do we need a NthIntWithKBits() in this topic?
>>>
>>>
>>> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . <
>>> jatka.oppimi...@gmail.com> wrote:
>>>


 On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor >>> > wrote:

> Can anybody give a full explanation
>
> http://ideone.com/K1QmV

>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
> sunny816.i...@gmail.com> wrote:
>
>> try to find out the binary representation of float value 5.2
>>
>>
>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta <
>> sangeeta15...@gmail.com> wrote:
>>
>>> int main(){
>>> int i;
>>> float a=5.2;
>>> char *ptr;
>>> ptr=(char *)&a;
>>> for(i=0;i<=3;i++)
>>> printf("%d ",*ptr++);
>>> }
>>>
>>> output:
>>>  102 102 -90 64.explain?
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 e

Re: [algogeeks] c doubt

2011-07-13 Thread sunny agrawal
I think it is machine dependent and current output is for a little endian
machine
and output should be reverse for a big endian machine

On Wed, Jul 13, 2011 at 10:18 PM, Anika Jain  wrote:

> it is not unsigned its signed but positive thts y it is 0..
> the order isnt reversed.. look at the code, the code 1st prints lowest
> order byte then next and then next and then highest soo output is 102 102
> -90 64
>
>
> On Wed, Jul 13, 2011 at 8:08 PM, Piyush Kapoor wrote:
>
>> why is the order of numbers reversed?
>>
>>
>> On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain wrote:
>>
>>> sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is
>>> 0
>>>
>>>
>>> On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor wrote:
>>>
 Shouldn't the value of "1100" be -64


 On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain wrote:

> binary equivalent of 5.2 is
> 101.0011001100110011001100110011(nonterminating)..
>
> now it is actually stored in normalised frorm in 32 bits..
> like this
> <--1 bit for sign---><-8 bits for exponent-><23 bits
> for fraction-->
> this is from higher order byte to lower order for little endian..
>
> if no. is positive sign bit is 0 else it is 1
>
> The rule says change your floating point no. in such a form that after
> 1st digit that is 1 decimal point comes sooo
> here it becomes like
> 1.0100110011001100110011001100110011(nonterminating) * 2^2
>
> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
> exponent is stored as 127+exponent so here it becomes 1001..
>
> now fraction here is clearly value after the decimal point i.e.
> 01001100110011001100110011001100110011(non terminationg) but only 1st 23
> bits are saved rest are left
>
> so finally wht we get is:
>
> 1100 10100110 01100110 01100110
> (64)  (-90) (102)(102)
>
>
>
> On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor wrote:
>
>> why do we need a NthIntWithKBits() in this topic?
>>
>>
>> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . > > wrote:
>>
>>>
>>>
>>> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor 
>>> wrote:
>>>
 Can anybody give a full explanation

 http://ideone.com/K1QmV
>>>
  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
 sunny816.i...@gmail.com> wrote:

> try to find out the binary representation of float value 5.2
>
>
> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta  > wrote:
>
>> int main(){
>> int i;
>> float a=5.2;
>> char *ptr;
>> ptr=(char *)&a;
>> for(i=0;i<=3;i++)
>> printf("%d ",*ptr++);
>> }
>>
>> output:
>>  102 102 -90 64.explain?
>>
>> --
>> 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.
>>
>>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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.
>



 --
 *Regards,*
 *Piyush Kapoor,*
 *CSE-IT-BHU*

  --
 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.
>>>
>>
>>
>>
>> --
>> *Regards,*
>> *Piyush Kapoor,*
>>

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
it is not unsigned its signed but positive thts y it is 0..
the order isnt reversed.. look at the code, the code 1st prints lowest order
byte then next and then next and then highest soo output is 102 102 -90 64

On Wed, Jul 13, 2011 at 8:08 PM, Piyush Kapoor  wrote:

> why is the order of numbers reversed?
>
>
> On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain wrote:
>
>> sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is 0
>>
>>
>> On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor wrote:
>>
>>> Shouldn't the value of "1100" be -64
>>>
>>>
>>> On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain wrote:
>>>
 binary equivalent of 5.2 is
 101.0011001100110011001100110011(nonterminating)..

 now it is actually stored in normalised frorm in 32 bits..
 like this
 <--1 bit for sign---><-8 bits for exponent-><23 bits for
 fraction-->
 this is from higher order byte to lower order for little endian..

 if no. is positive sign bit is 0 else it is 1

 The rule says change your floating point no. in such a form that after
 1st digit that is 1 decimal point comes sooo
 here it becomes like
 1.0100110011001100110011001100110011(nonterminating) * 2^2

 so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
 exponent is stored as 127+exponent so here it becomes 1001..

 now fraction here is clearly value after the decimal point i.e.
 01001100110011001100110011001100110011(non terminationg) but only 1st 23
 bits are saved rest are left

 so finally wht we get is:

 1100 10100110 01100110 01100110
 (64)  (-90) (102)(102)



 On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor wrote:

> why do we need a NthIntWithKBits() in this topic?
>
>
> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . 
> wrote:
>
>>
>>
>> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor 
>> wrote:
>>
>>> Can anybody give a full explanation
>>>
>>> http://ideone.com/K1QmV
>>
>>>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
>>> sunny816.i...@gmail.com> wrote:
>>>
 try to find out the binary representation of float value 5.2


 On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta 
 wrote:

> int main(){
> int i;
> float a=5.2;
> char *ptr;
> ptr=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%d ",*ptr++);
> }
>
> output:
>  102 102 -90 64.explain?
>
> --
> 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.
>
>


 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee


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

>>>
>>>
>>>
>>> --
>>> *Regards,*
>>> *Piyush Kapoor,*
>>> *CSE-IT-BHU*
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 gro

Re: [algogeeks] c doubt

2011-07-13 Thread Piyush Kapoor
why is the order of numbers reversed?

On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain  wrote:

> sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is 0
>
>
> On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor wrote:
>
>> Shouldn't the value of "1100" be -64
>>
>>
>> On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain wrote:
>>
>>> binary equivalent of 5.2 is
>>> 101.0011001100110011001100110011(nonterminating)..
>>>
>>> now it is actually stored in normalised frorm in 32 bits..
>>> like this
>>> <--1 bit for sign---><-8 bits for exponent-><23 bits for
>>> fraction-->
>>> this is from higher order byte to lower order for little endian..
>>>
>>> if no. is positive sign bit is 0 else it is 1
>>>
>>> The rule says change your floating point no. in such a form that after
>>> 1st digit that is 1 decimal point comes sooo
>>> here it becomes like 1.0100110011001100110011001100110011(nonterminating)
>>> * 2^2
>>>
>>> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
>>> exponent is stored as 127+exponent so here it becomes 1001..
>>>
>>> now fraction here is clearly value after the decimal point i.e.
>>> 01001100110011001100110011001100110011(non terminationg) but only 1st 23
>>> bits are saved rest are left
>>>
>>> so finally wht we get is:
>>>
>>> 1100 10100110 01100110 01100110
>>> (64)  (-90) (102)(102)
>>>
>>>
>>>
>>> On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor wrote:
>>>
 why do we need a NthIntWithKBits() in this topic?


 On Tue, Jul 12, 2011 at 7:58 AM, oppilas . 
 wrote:

>
>
> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor wrote:
>
>> Can anybody give a full explanation
>>
>> http://ideone.com/K1QmV
>
>>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
>> sunny816.i...@gmail.com> wrote:
>>
>>> try to find out the binary representation of float value 5.2
>>>
>>>
>>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta 
>>> wrote:
>>>
 int main(){
 int i;
 float a=5.2;
 char *ptr;
 ptr=(char *)&a;
 for(i=0;i<=3;i++)
 printf("%d ",*ptr++);
 }

 output:
  102 102 -90 64.explain?

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


>>>
>>>
>>> --
>>> Sunny Aggrawal
>>> B-Tech IV year,CSI
>>> Indian Institute Of Technology,Roorkee
>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> *Regards,*
>> *Piyush Kapoor,*
>> *CSE-IT-BHU*
>>
>>  --
>> 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.
>



 --
 *Regards,*
 *Piyush Kapoor,*
 *CSE-IT-BHU*

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

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is 0

On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor  wrote:

> Shouldn't the value of "1100" be -64
>
>
> On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain wrote:
>
>> binary equivalent of 5.2 is
>> 101.0011001100110011001100110011(nonterminating)..
>>
>> now it is actually stored in normalised frorm in 32 bits..
>> like this
>> <--1 bit for sign---><-8 bits for exponent-><23 bits for
>> fraction-->
>> this is from higher order byte to lower order for little endian..
>>
>> if no. is positive sign bit is 0 else it is 1
>>
>> The rule says change your floating point no. in such a form that after 1st
>> digit that is 1 decimal point comes sooo
>> here it becomes like 1.0100110011001100110011001100110011(nonterminating)
>> * 2^2
>>
>> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
>> exponent is stored as 127+exponent so here it becomes 1001..
>>
>> now fraction here is clearly value after the decimal point i.e.
>> 01001100110011001100110011001100110011(non terminationg) but only 1st 23
>> bits are saved rest are left
>>
>> so finally wht we get is:
>>
>> 1100 10100110 01100110 01100110
>> (64)  (-90) (102)(102)
>>
>>
>>
>> On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor wrote:
>>
>>> why do we need a NthIntWithKBits() in this topic?
>>>
>>>
>>> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . wrote:
>>>


 On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor wrote:

> Can anybody give a full explanation
>
> http://ideone.com/K1QmV

>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
> sunny816.i...@gmail.com> wrote:
>
>> try to find out the binary representation of float value 5.2
>>
>>
>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta wrote:
>>
>>> int main(){
>>> int i;
>>> float a=5.2;
>>> char *ptr;
>>> ptr=(char *)&a;
>>> for(i=0;i<=3;i++)
>>> printf("%d ",*ptr++);
>>> }
>>>
>>> output:
>>>  102 102 -90 64.explain?
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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.

>>>
>>>
>>>
>>> --
>>> *Regards,*
>>> *Piyush Kapoor,*
>>> *CSE-IT-BHU*
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 unsubscrib

Re: [algogeeks] c doubt

2011-07-13 Thread Piyush Kapoor
Shouldn't the value of "1100" be -64

On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain  wrote:

> binary equivalent of 5.2 is
> 101.0011001100110011001100110011(nonterminating)..
>
> now it is actually stored in normalised frorm in 32 bits..
> like this
> <--1 bit for sign---><-8 bits for exponent-><23 bits for
> fraction-->
> this is from higher order byte to lower order for little endian..
>
> if no. is positive sign bit is 0 else it is 1
>
> The rule says change your floating point no. in such a form that after 1st
> digit that is 1 decimal point comes sooo
> here it becomes like 1.0100110011001100110011001100110011(nonterminating) *
> 2^2
>
> so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
> exponent is stored as 127+exponent so here it becomes 1001..
>
> now fraction here is clearly value after the decimal point i.e.
> 01001100110011001100110011001100110011(non terminationg) but only 1st 23
> bits are saved rest are left
>
> so finally wht we get is:
>
> 1100 10100110 01100110 01100110
> (64)  (-90) (102)(102)
>
>
>
> On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor wrote:
>
>> why do we need a NthIntWithKBits() in this topic?
>>
>>
>> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . wrote:
>>
>>>
>>>
>>> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor wrote:
>>>
 Can anybody give a full explanation

 http://ideone.com/K1QmV
>>>
  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <
 sunny816.i...@gmail.com> wrote:

> try to find out the binary representation of float value 5.2
>
>
> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta wrote:
>
>> int main(){
>> int i;
>> float a=5.2;
>> char *ptr;
>> ptr=(char *)&a;
>> for(i=0;i<=3;i++)
>> printf("%d ",*ptr++);
>> }
>>
>> output:
>>  102 102 -90 64.explain?
>>
>> --
>> 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.
>>
>>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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.
>



 --
 *Regards,*
 *Piyush Kapoor,*
 *CSE-IT-BHU*

  --
 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.
>>>
>>
>>
>>
>> --
>> *Regards,*
>> *Piyush Kapoor,*
>> *CSE-IT-BHU*
>>
>>  --
>> 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.
>



-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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

2011-07-13 Thread Anika Jain
binary equivalent of 5.2 is
101.0011001100110011001100110011(nonterminating)..

now it is actually stored in normalised frorm in 32 bits..
like this
<--1 bit for sign---><-8 bits for exponent-><23 bits for
fraction-->
this is from higher order byte to lower order for little endian..

if no. is positive sign bit is 0 else it is 1

The rule says change your floating point no. in such a form that after 1st
digit that is 1 decimal point comes sooo
here it becomes like 1.0100110011001100110011001100110011(nonterminating) *
2^2

so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
exponent is stored as 127+exponent so here it becomes 1001..

now fraction here is clearly value after the decimal point i.e.
01001100110011001100110011001100110011(non terminationg) but only 1st 23
bits are saved rest are left

so finally wht we get is:

1100 10100110 01100110 01100110
(64)  (-90) (102)(102)


On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor  wrote:

> why do we need a NthIntWithKBits() in this topic?
>
>
> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . wrote:
>
>>
>>
>> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor wrote:
>>
>>> Can anybody give a full explanation
>>>
>>> http://ideone.com/K1QmV
>>
>>>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal >> > wrote:
>>>
 try to find out the binary representation of float value 5.2


 On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta wrote:

> int main(){
> int i;
> float a=5.2;
> char *ptr;
> ptr=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%d ",*ptr++);
> }
>
> output:
>  102 102 -90 64.explain?
>
> --
> 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.
>
>


 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee


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

>>>
>>>
>>>
>>> --
>>> *Regards,*
>>> *Piyush Kapoor,*
>>> *CSE-IT-BHU*
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 doubt

2011-07-13 Thread Piyush Kapoor
why do we need a NthIntWithKBits() in this topic?

On Tue, Jul 12, 2011 at 7:58 AM, oppilas . wrote:

>
>
> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor wrote:
>
>> Can anybody give a full explanation
>>
>> http://ideone.com/K1QmV
>
>> On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal 
>> wrote:
>>
>>> try to find out the binary representation of float value 5.2
>>>
>>>
>>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta wrote:
>>>
 int main(){
 int i;
 float a=5.2;
 char *ptr;
 ptr=(char *)&a;
 for(i=0;i<=3;i++)
 printf("%d ",*ptr++);
 }

 output:
  102 102 -90 64.explain?

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


>>>
>>>
>>> --
>>> Sunny Aggrawal
>>> B-Tech IV year,CSI
>>> Indian Institute Of Technology,Roorkee
>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> *Regards,*
>> *Piyush Kapoor,*
>> *CSE-IT-BHU*
>>
>>  --
>> 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.
>



-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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

2011-07-11 Thread oppilas .
On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor  wrote:

> Can anybody give a full explanation
>
> http://ideone.com/K1QmV

> On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal wrote:
>
>> try to find out the binary representation of float value 5.2
>>
>>
>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta wrote:
>>
>>> int main(){
>>> int i;
>>> float a=5.2;
>>> char *ptr;
>>> ptr=(char *)&a;
>>> for(i=0;i<=3;i++)
>>> printf("%d ",*ptr++);
>>> }
>>>
>>> output:
>>>  102 102 -90 64.explain?
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 doubt

2011-07-11 Thread Sandeep Jain
Sunny is right.
Try to observe the binary representation, and you shall get your answers.


Regards,
Sandeep Jain



On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor  wrote:

> Can anybody give a full explanation
>
>
> On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal wrote:
>
>> try to find out the binary representation of float value 5.2
>>
>>
>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta wrote:
>>
>>> int main(){
>>> int i;
>>> float a=5.2;
>>> char *ptr;
>>> ptr=(char *)&a;
>>> for(i=0;i<=3;i++)
>>> printf("%d ",*ptr++);
>>> }
>>>
>>> output:
>>>  102 102 -90 64.explain?
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 doubt

2011-07-11 Thread Piyush Kapoor
Can anybody give a full explanation


On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal wrote:

> try to find out the binary representation of float value 5.2
>
>
> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta  wrote:
>
>> int main(){
>> int i;
>> float a=5.2;
>> char *ptr;
>> ptr=(char *)&a;
>> for(i=0;i<=3;i++)
>> printf("%d ",*ptr++);
>> }
>>
>> output:
>>  102 102 -90 64.explain?
>>
>> --
>> 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.
>>
>>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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.
>



-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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

2011-07-11 Thread nicks
@vaibhav.i don't think there is any rule like you mentioned.if it is
plz mention it's source

i think the explanation by aditya is correct it's just due to the precedence
order which is

>=
?:
=
in descending order

hence first >= is evaluated then ?: followed by =...due to which lvalue
error occurs as constant is on the left side !!
On Mon, Jul 11, 2011 at 2:08 PM, vaibhav shukla wrote:

> remember in C , the false statement cannot be used for assignment, if u
> write it without braces.It is allowed in C++ but not in C
> In C compiler would treat it as what aditya has explained.hence the error.
>
> On Mon, Jul 11, 2011 at 12:59 PM, aditya pratap <
> contacttoadity...@gmail.com> wrote:
>
>> this is something like this thats why it is giving lvalue required.
>> u r going to store the the value over value which is not a variable at
>> left hand side.
>>
>> main(){int a=10,b;
>> (a>=5?b=10:b)=20;printf 
>> ("%d\n",b);}
>>
>>
>>
>>
>> On Mon, Jul 11, 2011 at 12:47 PM, geek forgeek wrote:
>>
>>> #include
>>> main(){int a=10,b;
>>> a>=5?b=10:b=20;printf 
>>> ("%d\n",b);}
>>>
>>> y this is asking for lvalue
>>> while this(below) not?
>>>
>>>
>>> #include
>>> main(){int a=10,b;
>>> a>=5?b=10:(b=20);printf 
>>> ("%d\n",b);}
>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> Regards
>> Aditya Pratap
>> MCA II
>>
>>  --
>> 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.
>>
>
>
>
> --
>   best wishes!!
> Vaibhav Shukla
> DU-MCA
>
>  --
> 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 doubt

2011-07-11 Thread vaibhav shukla
remember in C , the false statement cannot be used for assignment, if u
write it without braces.It is allowed in C++ but not in C
In C compiler would treat it as what aditya has explained.hence the error.

On Mon, Jul 11, 2011 at 12:59 PM, aditya pratap  wrote:

> this is something like this thats why it is giving lvalue required.
> u r going to store the the value over value which is not a variable at left
> hand side.
>
>
> main(){int a=10,b;
> (a>=5?b=10:b)=20;printf 
> ("%d\n",b);}
>
>
>
> On Mon, Jul 11, 2011 at 12:47 PM, geek forgeek wrote:
>
>> #include
>> main(){int a=10,b;
>> a>=5?b=10:b=20;printf 
>> ("%d\n",b);}
>>
>> y this is asking for lvalue
>> while this(below) not?
>>
>>
>> #include
>> main(){int a=10,b;
>> a>=5?b=10:(b=20);printf 
>> ("%d\n",b);}
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> Regards
> Aditya Pratap
> MCA II
>
>  --
> 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.
>



-- 
  best wishes!!
Vaibhav Shukla
DU-MCA

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

2011-07-11 Thread aditya pratap
this is something like this thats why it is giving lvalue required.
u r going to store the the value over value which is not a variable at left
hand side.

main(){int a=10,b;
(a>=5?b=10:b)=20;printf
("%d\n",b);}


On Mon, Jul 11, 2011 at 12:47 PM, geek forgeek wrote:

> #include
> main(){int a=10,b;
> a>=5?b=10:b=20;printf 
> ("%d\n",b);}
>
> y this is asking for lvalue
> while this(below) not?
>
>
> #include
> main(){int a=10,b;
> a>=5?b=10:(b=20);printf 
> ("%d\n",b);}
>
>
>  --
> 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.
>



-- 
Regards
Aditya Pratap
MCA II

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

2011-07-11 Thread geek forgeek
#include
main(){int a=10,b;
a>=5?b=10:b=20;printf
("%d\n",b);}

y this is asking for lvalue
while this(below) not?


#include
main(){int a=10,b;
a>=5?b=10:(b=20);printf
("%d\n",b);}

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

2011-07-10 Thread Sandeep Jain
http://www.parashift.com/c++-faq-lite/virtual-functions.html
Its one of my favorite sites... :)


Regards,
Sandeep Jain



On Mon, Jul 11, 2011 at 12:02 AM, himanshu kansal <
himanshukansal...@gmail.com> wrote:

> thanku sir...sir 1 more thngcn u gv a link or some pdf for studying
> virtual inheritance elaborating the vptr mechanism more clearly...
>
>
> On Sun, Jul 10, 2011 at 11:56 PM, Sandeep Jain wrote:
>
>> The reason is... that when u write
>>  a obj1=14;
>> it is same as writing a obj1 = a(14);
>> So first a temporary object is created using the constructor
>> a(int i)
>> And this temporary object is passed in the copy constructor. BUT since it
>> is temp object it must be referred by a const alias.
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>> On Sun, Jul 10, 2011 at 11:52 PM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> a obj3(obj1);but this statement works fine.so it means it is
>>> calling copy constt. perfectly...
>>>
>>>
>>> On Sun, Jul 10, 2011 at 11:49 PM, rahul  wrote:
>>>
 my badadd const in copy construcori think...that compiler
 expect...


 On Sun, Jul 10, 2011 at 11:48 PM, rahul  wrote:

> use a(int arg)
> {
>x = arg;
> }
>
>
> ur call will work...:)
>
>
> On Sun, Jul 10, 2011 at 11:46 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> class a
>> {
>>int x;
>> public:
>>a()
>>{
>>}
>>a(int i){x=i;cout<<"in a "<>a(a &obj){cout<<"in copy cons of a"<>
>> };
>>
>> a obj1=14;  //error no matching call to a::a(a)
>>
>>
>> why.
>> and just adding a const in the constructor  saves me from error...but
>> 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.

>>>
>>>
>>>
>>> --
>>>
>>>   Regards
>>> Himanshu Kansal
>>>   Msc Comp. sc.
>>> (University of Delhi)
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of Delhi)
>
>  --
> 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++ doubt

2011-07-10 Thread himanshu kansal
thanku sir...sir 1 more thngcn u gv a link or some pdf for studying
virtual inheritance elaborating the vptr mechanism more clearly...

On Sun, Jul 10, 2011 at 11:56 PM, Sandeep Jain wrote:

> The reason is... that when u write
>  a obj1=14;
> it is same as writing a obj1 = a(14);
> So first a temporary object is created using the constructor
> a(int i)
> And this temporary object is passed in the copy constructor. BUT since it
> is temp object it must be referred by a const alias.
>
>
> Regards,
> Sandeep Jain
>
>
>
> On Sun, Jul 10, 2011 at 11:52 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> a obj3(obj1);but this statement works fine.so it means it is
>> calling copy constt. perfectly...
>>
>>
>> On Sun, Jul 10, 2011 at 11:49 PM, rahul  wrote:
>>
>>> my badadd const in copy construcori think...that compiler
>>> expect...
>>>
>>>
>>> On Sun, Jul 10, 2011 at 11:48 PM, rahul  wrote:
>>>
 use a(int arg)
 {
x = arg;
 }


 ur call will work...:)


 On Sun, Jul 10, 2011 at 11:46 PM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> class a
> {
>int x;
> public:
>a()
>{
>}
>a(int i){x=i;cout<<"in a " };
>
> a obj1=14;  //error no matching call to a::a(a)
>
>
> why.
> and just adding a const in the constructor  saves me from error...but
> 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.
>>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of Delhi)
>>
>>  --
>> 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.
>



-- 

  Regards
Himanshu Kansal
  Msc Comp. sc.
(University of Delhi)

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

2011-07-10 Thread Sandeep Jain
The reason is... that when u write
 a obj1=14;
it is same as writing a obj1 = a(14);
So first a temporary object is created using the constructor
a(int i)
And this temporary object is passed in the copy constructor. BUT since it is
temp object it must be referred by a const alias.


Regards,
Sandeep Jain



On Sun, Jul 10, 2011 at 11:52 PM, himanshu kansal <
himanshukansal...@gmail.com> wrote:

> a obj3(obj1);but this statement works fine.so it means it is
> calling copy constt. perfectly...
>
>
> On Sun, Jul 10, 2011 at 11:49 PM, rahul  wrote:
>
>> my badadd const in copy construcori think...that compiler
>> expect...
>>
>>
>> On Sun, Jul 10, 2011 at 11:48 PM, rahul  wrote:
>>
>>> use a(int arg)
>>> {
>>>x = arg;
>>> }
>>>
>>>
>>> ur call will work...:)
>>>
>>>
>>> On Sun, Jul 10, 2011 at 11:46 PM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 class a
 {
int x;
 public:
a()
{
}
a(int i){x=i;cout<<"in a "<>>>a(a &obj){cout<<"in copy cons of a"<>>>
 };

 a obj1=14;  //error no matching call to a::a(a)


 why.
 and just adding a const in the constructor  saves me from error...but
 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.
>>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of Delhi)
>
>  --
> 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++ doubt

2011-07-10 Thread himanshu kansal
a obj3(obj1);but this statement works fine.so it means it is calling
copy constt. perfectly...

On Sun, Jul 10, 2011 at 11:49 PM, rahul  wrote:

> my badadd const in copy construcori think...that compiler expect...
>
>
> On Sun, Jul 10, 2011 at 11:48 PM, rahul  wrote:
>
>> use a(int arg)
>> {
>>x = arg;
>> }
>>
>>
>> ur call will work...:)
>>
>>
>> On Sun, Jul 10, 2011 at 11:46 PM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> class a
>>> {
>>>int x;
>>> public:
>>>a()
>>>{
>>>}
>>>a(int i){x=i;cout<<"in a "<>>a(a &obj){cout<<"in copy cons of a"<>>
>>> };
>>>
>>> a obj1=14;  //error no matching call to a::a(a)
>>>
>>>
>>> why.
>>> and just adding a const in the constructor  saves me from error...but
>>> 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.
>



-- 

  Regards
Himanshu Kansal
  Msc Comp. sc.
(University of Delhi)

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

2011-07-10 Thread rahul
my badadd const in copy construcori think...that compiler expect...

On Sun, Jul 10, 2011 at 11:48 PM, rahul  wrote:

> use a(int arg)
> {
>x = arg;
> }
>
>
> ur call will work...:)
>
>
> On Sun, Jul 10, 2011 at 11:46 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> class a
>> {
>>int x;
>> public:
>>a()
>>{
>>}
>>a(int i){x=i;cout<<"in a "<>a(a &obj){cout<<"in copy cons of a"<>
>> };
>>
>> a obj1=14;  //error no matching call to a::a(a)
>>
>>
>> why.
>> and just adding a const in the constructor  saves me from error...but
>> 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++ doubt

2011-07-10 Thread rahul
use a(int arg)
{
   x = arg;
}


ur call will work...:)

On Sun, Jul 10, 2011 at 11:46 PM, himanshu kansal <
himanshukansal...@gmail.com> wrote:

> class a
> {
>int x;
> public:
>a()
>{
>}
>a(int i){x=i;cout<<"in a " };
>
> a obj1=14;  //error no matching call to a::a(a)
>
>
> why.
> and just adding a const in the constructor  saves me from error...but
> 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++ doubt

2011-07-10 Thread himanshu kansal
class a
{
int x;
public:
a()
{
}
a(int i){x=i;cout<<"in a "

Re: [algogeeks] c doubt

2011-07-09 Thread sunny agrawal
try to find out the binary representation of float value 5.2

On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta  wrote:

> int main(){
> int i;
> float a=5.2;
> char *ptr;
> ptr=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%d ",*ptr++);
> }
>
> output:
>  102 102 -90 64.explain?
>
> --
> 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.
>
>


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

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

2011-07-09 Thread Sangeeta
int main(){
int i;
float a=5.2;
char *ptr;
ptr=(char *)&a;
for(i=0;i<=3;i++)
printf("%d ",*ptr++);
}

output:
 102 102 -90 64.explain?

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

2011-07-04 Thread sangeeta goyal
thanx i got it :)

On Mon, Jul 4, 2011 at 2:05 PM, Sandeep Jain  wrote:

> If you try to visualize the internal representation.
> You've allocated 10 bytes.
> | h | e | l | l | o |
> | h | i |\0 |\0 |\0 |
>
> Since these are stored in linear form, so the actual representation would
> be
> | h | e | l | l | o | h | i |\0 |\0 |\0 |
>
>
> Now a[0] points to 'h' in the first row, and printf starts to print
> characters one by one till it finds null, i.e. \0
> Thus it prints from "hellohi"
> And similarly printing a[1] prints only "hi"
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Mon, Jul 4, 2011 at 1:48 PM, Sangeeta  wrote:
>
>> #include
>> #include
>> void main()
>> {
>> char a[2][5]= {
>> "hellodear",
>>  "hi"};
>> printf("%s%s",a[0],a[1]);
>> }
>> output:hellohi hi
>> explain?
>>
>> --
>> 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 doubt

2011-07-04 Thread Sandeep Jain
If you try to visualize the internal representation.
You've allocated 10 bytes.
| h | e | l | l | o |
| h | i |\0 |\0 |\0 |

Since these are stored in linear form, so the actual representation would be
| h | e | l | l | o | h | i |\0 |\0 |\0 |


Now a[0] points to 'h' in the first row, and printf starts to print
characters one by one till it finds null, i.e. \0
Thus it prints from "hellohi"
And similarly printing a[1] prints only "hi"


Regards,
Sandeep Jain




On Mon, Jul 4, 2011 at 1:48 PM, Sangeeta  wrote:

> #include
> #include
> void main()
> {
> char a[2][5]= {
> "hellodear",
>  "hi"};
> printf("%s%s",a[0],a[1]);
> }
> output:hellohi hi
> explain?
>
> --
> 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 doubt

2011-07-04 Thread sameer.mut...@gmail.com
Continuous memory allocation is used for 2-d array.
So a[2][5] will assign 10 continuous memory spaces.
Hello will be stored on the 1st 5 spaces. Hi will be saved on the next 2
consecutive spaces itself.
There is no null character saved for the 1st string so while printing it
prints until it finds a null character which exists only after hi.

So a[0] prints hellohi
and a[1] prints hi

On Mon, Jul 4, 2011 at 1:48 PM, Sangeeta  wrote:

> #include
> #include
> void main()
> {
> char a[2][5]= {
> "hellodear",
>  "hi"};
> printf("%s%s",a[0],a[1]);
> }

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

2011-07-04 Thread sameer.mut...@gmail.com
The meaning of 0 is being escaped, it now represents Octal and the following
digits are taken to be an octal number. Ascii equivalent of the octal no. is
being taken as a character.
Ascii equivalent of octal no. 61 is 1. So it takes it to be 4 characters..
S,1,A,B

Another example would be..

#include
#include
main()
{
char str[]="S\051AB";

printf("%s\n",str);
}

Output:
S)AB

because Ascii value of ) is 51(in octal format).


On Mon, Jul 4, 2011 at 12:59 PM, Vishal Thanki wrote:

> because "\061" is considered as a single char in ur string..
>
> On Mon, Jul 4, 2011 at 12:52 PM, Sangeeta  wrote:
> > #Iinclude
> > #include
> > main()
> > {
> > char str[]="S\061AB";
> > printf("\n%d",strlen(str));
> > }
> > output:4
> > why?
> >
> > --
> > 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 doubt

2011-07-04 Thread Sangeeta
#include
#include
void main()
{
char a[2][5]= {
 "hellodear",
  "hi"};
printf("%s%s",a[0],a[1]);
}
output:hellohi hi
explain?

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

2011-07-04 Thread Vishal Thanki
because "\061" is considered as a single char in ur string..

On Mon, Jul 4, 2011 at 12:52 PM, Sangeeta  wrote:
> #Iinclude
> #include
> main()
> {
> char str[]="S\061AB";
> printf("\n%d",strlen(str));
> }
> output:4
> why?
>
> --
> 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 doubt

2011-07-04 Thread Sangeeta
#Iinclude
#include
main()
{
char str[]="S\061AB";
printf("\n%d",strlen(str));
}
output:4
why?

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

2011-06-24 Thread Anika Jain
ya i got it.. thanx

On Thu, Jun 23, 2011 at 6:01 PM, rajeev bharshetty wrote:

> It is because of the ! operator in front of a , !a is always 0(in case a is
> value other than 0) so it takes it as integer and hence the size is 4 bytes
> whereas only a you will get 12 . The ! changes the data type here .
> Hope it clears the doubt :)
>
>
> -
>
>
> Rajeev N B
>
> I Blog @ www.opensourcemania.co.cc
>
> On Thu, Jun 23, 2011 at 5:52 PM, Anika Jain wrote:
>
>> int main()
>> {
>> long double a;
>> signed char b;
>> printf("%d\n",sizeof(!a+b));
>> return 0;
>> }
>>
>> why is it 4?? shouldnt it be 12 as per sizeof long double in gccc
>>
>> --
>> 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 doubt

2011-06-23 Thread rajeev bharshetty
It is because of the ! operator in front of a , !a is always 0(in case a is
value other than 0) so it takes it as integer and hence the size is 4 bytes
whereas only a you will get 12 . The ! changes the data type here .
Hope it clears the doubt :)


-


Rajeev N B

I Blog @ www.opensourcemania.co.cc

On Thu, Jun 23, 2011 at 5:52 PM, Anika Jain  wrote:

> int main()
> {
> long double a;
> signed char b;
> printf("%d\n",sizeof(!a+b));
> return 0;
> }
>
> why is it 4?? shouldnt it be 12 as per sizeof long double in gccc
>
> --
> 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 doubt again

2011-06-23 Thread harshit pahuja
@anika -thankx :)

On Thu, Jun 23, 2011 at 11:57 AM, Anika Jain  wrote:

> @ harshit: i find such questions from books like let us c, test ur c,
> dennis ritchie and from test papers of companies that visit campus
>
>
> On Thu, Jun 23, 2011 at 9:15 AM, Piyush Sinha wrote:
>
>> or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and
>> O/Ps
>>
>> On 6/23/11, harshit pahuja  wrote:
>> > @rajeev
>> >
>> > http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
>> > http://www.cplusplus.com/reference/clibrary/cstdio/printf/
>> >
>> > On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
>> > wrote:
>> >
>> >> @ Piyush Could u provide the link to some source , because i am still
>> >> unclear about the above concept .
>> >>
>> >> Regards
>> >> Rajeev N B
>> >>
>> >>
>> >>
>> >>
>> >> On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
>> >> wrote:
>> >>
>> >>> there is no as such logic behind it..its just the format specifier...
>> >>>
>> >>> u must be knowing printf returns the number of values it has printed(u
>> >>> can
>> >>> check that)
>> >>>
>> >>> now, in printf if u write like *printf("%7s","a"), *it will create 7
>> >>> columns for the output and print a in the last column and the returned
>> >>> value
>> >>> of this printf will be 7..(u can check it)
>> >>>
>> >>> now if u write *printf("%*s",7,"a")* then u r giving additional
>> >>> information of format specifier i.e 7..returned value of this printf
>> is
>> >>> also
>> >>> 7.
>> >>>
>> >>> Hence the above logic..hope I am able to clarify it...:)
>> >>>
>> >>>
>> >>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
>> >>> wrote:
>> >>>
>>  i mean how it working actually?
>> 
>> 
>>  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
>>  wrote:
>> 
>> > hey ya its working :) but whats the logic behind it??
>> >
>> >
>> > On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha <
>> ecstasy.piy...@gmail.com
>> > > wrote:
>> >
>> >> sorry by mistake i added it in scanf situation..
>> >> actually this type of specifier can be used with printf statement
>> for
>> >> finding the sum...
>> >>
>> >> look at the code below
>> >>
>> >> main()
>> >> {
>> >> int a=9;
>> >> int b=3;
>> >> printf("%d\n",printf("%*s%*s",a,"",b,""));
>> >> system("pause");
>> >> }
>> >>
>> >> On 6/23/11, Anika Jain  wrote:
>> >> > thanx .. can u explain me how this is used in finding sum of 2
>> vars
>> >> without
>> >> > using + ??
>> >> >
>> >> >
>> >> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
>> >> > wrote:
>> >> >
>> >> >> An asterisk indicates that the data is to be retrieved from the
>> use
>> >> >> but ignored, i.e. it is not stored in the corresponding
>> >> >> argument...hence the third value entered gets stored for b and
>> for
>> >> >> c
>> >> >> the output comes to garbage value
>> >> >>
>> >> >> One beautiful application of such type of implementation is in
>> >> finding
>> >> >> the sum of 2 variables without using + operator..:)
>> >> >>
>> >> >> On 6/23/11, Anika Jain  wrote:
>> >> >> > int main()
>> >> >> > {
>> >> >> >int a,b, c;
>> >> >> >scanf("%d%*d%d",&a,&b,&c);
>> >> >> >printf("%d %d %d",a,b,c);
>> >> >> > }
>> >> >> >
>> >> >> > output: 25 35 garbage
>> >> >> >
>> >> >> > how is it happening??
>> >> >> >
>> >> >> > --
>> >> >> > 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.
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >> --
>> >> >> *Piyush Sinha*
>> >> >> *IIIT, Allahabad*
>> >> >> *+91-8792136657*
>> >> >> *+91-7483122727*
>> >> >> *https://www.facebook.com/profile.php?id=10655377926 *
>> >> >>
>> >> >> --
>> >> >> 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.
>> >

Re: [algogeeks] c doubt again

2011-06-23 Thread Anika Jain
@ piyush : oh thanx.. i understood it :)

On Thu, Jun 23, 2011 at 11:57 AM, Anika Jain  wrote:

> @ harshit: i find such questions from books like let us c, test ur c,
> dennis ritchie and from test papers of companies that visit campus
>
>
> On Thu, Jun 23, 2011 at 9:15 AM, Piyush Sinha wrote:
>
>> or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and
>> O/Ps
>>
>> On 6/23/11, harshit pahuja  wrote:
>> > @rajeev
>> >
>> > http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
>> > http://www.cplusplus.com/reference/clibrary/cstdio/printf/
>> >
>> > On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
>> > wrote:
>> >
>> >> @ Piyush Could u provide the link to some source , because i am still
>> >> unclear about the above concept .
>> >>
>> >> Regards
>> >> Rajeev N B
>> >>
>> >>
>> >>
>> >>
>> >> On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
>> >> wrote:
>> >>
>> >>> there is no as such logic behind it..its just the format specifier...
>> >>>
>> >>> u must be knowing printf returns the number of values it has printed(u
>> >>> can
>> >>> check that)
>> >>>
>> >>> now, in printf if u write like *printf("%7s","a"), *it will create 7
>> >>> columns for the output and print a in the last column and the returned
>> >>> value
>> >>> of this printf will be 7..(u can check it)
>> >>>
>> >>> now if u write *printf("%*s",7,"a")* then u r giving additional
>> >>> information of format specifier i.e 7..returned value of this printf
>> is
>> >>> also
>> >>> 7.
>> >>>
>> >>> Hence the above logic..hope I am able to clarify it...:)
>> >>>
>> >>>
>> >>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
>> >>> wrote:
>> >>>
>>  i mean how it working actually?
>> 
>> 
>>  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
>>  wrote:
>> 
>> > hey ya its working :) but whats the logic behind it??
>> >
>> >
>> > On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha <
>> ecstasy.piy...@gmail.com
>> > > wrote:
>> >
>> >> sorry by mistake i added it in scanf situation..
>> >> actually this type of specifier can be used with printf statement
>> for
>> >> finding the sum...
>> >>
>> >> look at the code below
>> >>
>> >> main()
>> >> {
>> >> int a=9;
>> >> int b=3;
>> >> printf("%d\n",printf("%*s%*s",a,"",b,""));
>> >> system("pause");
>> >> }
>> >>
>> >> On 6/23/11, Anika Jain  wrote:
>> >> > thanx .. can u explain me how this is used in finding sum of 2
>> vars
>> >> without
>> >> > using + ??
>> >> >
>> >> >
>> >> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
>> >> > wrote:
>> >> >
>> >> >> An asterisk indicates that the data is to be retrieved from the
>> use
>> >> >> but ignored, i.e. it is not stored in the corresponding
>> >> >> argument...hence the third value entered gets stored for b and
>> for
>> >> >> c
>> >> >> the output comes to garbage value
>> >> >>
>> >> >> One beautiful application of such type of implementation is in
>> >> finding
>> >> >> the sum of 2 variables without using + operator..:)
>> >> >>
>> >> >> On 6/23/11, Anika Jain  wrote:
>> >> >> > int main()
>> >> >> > {
>> >> >> >int a,b, c;
>> >> >> >scanf("%d%*d%d",&a,&b,&c);
>> >> >> >printf("%d %d %d",a,b,c);
>> >> >> > }
>> >> >> >
>> >> >> > output: 25 35 garbage
>> >> >> >
>> >> >> > how is it happening??
>> >> >> >
>> >> >> > --
>> >> >> > 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.
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >> --
>> >> >> *Piyush Sinha*
>> >> >> *IIIT, Allahabad*
>> >> >> *+91-8792136657*
>> >> >> *+91-7483122727*
>> >> >> *https://www.facebook.com/profile.php?id=10655377926 *
>> >> >>
>> >> >> --
>> >> >> 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@goo

Re: [algogeeks] c doubt again

2011-06-23 Thread Anika Jain
@ harshit: i find such questions from books like let us c, test ur c, dennis
ritchie and from test papers of companies that visit campus

On Thu, Jun 23, 2011 at 9:15 AM, Piyush Sinha wrote:

> or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and
> O/Ps
>
> On 6/23/11, harshit pahuja  wrote:
> > @rajeev
> >
> > http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
> > http://www.cplusplus.com/reference/clibrary/cstdio/printf/
> >
> > On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
> > wrote:
> >
> >> @ Piyush Could u provide the link to some source , because i am still
> >> unclear about the above concept .
> >>
> >> Regards
> >> Rajeev N B
> >>
> >>
> >>
> >>
> >> On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
> >> wrote:
> >>
> >>> there is no as such logic behind it..its just the format specifier...
> >>>
> >>> u must be knowing printf returns the number of values it has printed(u
> >>> can
> >>> check that)
> >>>
> >>> now, in printf if u write like *printf("%7s","a"), *it will create 7
> >>> columns for the output and print a in the last column and the returned
> >>> value
> >>> of this printf will be 7..(u can check it)
> >>>
> >>> now if u write *printf("%*s",7,"a")* then u r giving additional
> >>> information of format specifier i.e 7..returned value of this printf is
> >>> also
> >>> 7.
> >>>
> >>> Hence the above logic..hope I am able to clarify it...:)
> >>>
> >>>
> >>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
> >>> wrote:
> >>>
>  i mean how it working actually?
> 
> 
>  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
>  wrote:
> 
> > hey ya its working :) but whats the logic behind it??
> >
> >
> > On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha <
> ecstasy.piy...@gmail.com
> > > wrote:
> >
> >> sorry by mistake i added it in scanf situation..
> >> actually this type of specifier can be used with printf statement
> for
> >> finding the sum...
> >>
> >> look at the code below
> >>
> >> main()
> >> {
> >> int a=9;
> >> int b=3;
> >> printf("%d\n",printf("%*s%*s",a,"",b,""));
> >> system("pause");
> >> }
> >>
> >> On 6/23/11, Anika Jain  wrote:
> >> > thanx .. can u explain me how this is used in finding sum of 2
> vars
> >> without
> >> > using + ??
> >> >
> >> >
> >> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
> >> > wrote:
> >> >
> >> >> An asterisk indicates that the data is to be retrieved from the
> use
> >> >> but ignored, i.e. it is not stored in the corresponding
> >> >> argument...hence the third value entered gets stored for b and
> for
> >> >> c
> >> >> the output comes to garbage value
> >> >>
> >> >> One beautiful application of such type of implementation is in
> >> finding
> >> >> the sum of 2 variables without using + operator..:)
> >> >>
> >> >> On 6/23/11, Anika Jain  wrote:
> >> >> > int main()
> >> >> > {
> >> >> >int a,b, c;
> >> >> >scanf("%d%*d%d",&a,&b,&c);
> >> >> >printf("%d %d %d",a,b,c);
> >> >> > }
> >> >> >
> >> >> > output: 25 35 garbage
> >> >> >
> >> >> > how is it happening??
> >> >> >
> >> >> > --
> >> >> > 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.
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> *Piyush Sinha*
> >> >> *IIIT, Allahabad*
> >> >> *+91-8792136657*
> >> >> *+91-7483122727*
> >> >> *https://www.facebook.com/profile.php?id=10655377926 *
> >> >>
> >> >> --
> >> >> 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 doubt

2011-06-23 Thread Apoorve Mohan
@anika: the negation operation returns 0 or 1 which is an integerso u
get this output

On Thu, Jun 23, 2011 at 10:29 PM, piyush kapoor  wrote:

> Thanks a lot :)
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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.
>



-- 
regards

Apoorve Mohan

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

2011-06-23 Thread piyush kapoor
Thanks a lot :)

-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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

2011-06-23 Thread Piyush Sinha
or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and O/Ps

On 6/23/11, harshit pahuja  wrote:
> @rajeev
>
> http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
> http://www.cplusplus.com/reference/clibrary/cstdio/printf/
>
> On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
> wrote:
>
>> @ Piyush Could u provide the link to some source , because i am still
>> unclear about the above concept .
>>
>> Regards
>> Rajeev N B
>>
>>
>>
>>
>> On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
>> wrote:
>>
>>> there is no as such logic behind it..its just the format specifier...
>>>
>>> u must be knowing printf returns the number of values it has printed(u
>>> can
>>> check that)
>>>
>>> now, in printf if u write like *printf("%7s","a"), *it will create 7
>>> columns for the output and print a in the last column and the returned
>>> value
>>> of this printf will be 7..(u can check it)
>>>
>>> now if u write *printf("%*s",7,"a")* then u r giving additional
>>> information of format specifier i.e 7..returned value of this printf is
>>> also
>>> 7.
>>>
>>> Hence the above logic..hope I am able to clarify it...:)
>>>
>>>
>>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
>>> wrote:
>>>
 i mean how it working actually?


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
 wrote:

> hey ya its working :) but whats the logic behind it??
>
>
> On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha  > wrote:
>
>> sorry by mistake i added it in scanf situation..
>> actually this type of specifier can be used with printf statement for
>> finding the sum...
>>
>> look at the code below
>>
>> main()
>> {
>> int a=9;
>> int b=3;
>> printf("%d\n",printf("%*s%*s",a,"",b,""));
>> system("pause");
>> }
>>
>> On 6/23/11, Anika Jain  wrote:
>> > thanx .. can u explain me how this is used in finding sum of 2 vars
>> without
>> > using + ??
>> >
>> >
>> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
>> > wrote:
>> >
>> >> An asterisk indicates that the data is to be retrieved from the use
>> >> but ignored, i.e. it is not stored in the corresponding
>> >> argument...hence the third value entered gets stored for b and for
>> >> c
>> >> the output comes to garbage value
>> >>
>> >> One beautiful application of such type of implementation is in
>> finding
>> >> the sum of 2 variables without using + operator..:)
>> >>
>> >> On 6/23/11, Anika Jain  wrote:
>> >> > int main()
>> >> > {
>> >> >int a,b, c;
>> >> >scanf("%d%*d%d",&a,&b,&c);
>> >> >printf("%d %d %d",a,b,c);
>> >> > }
>> >> >
>> >> > output: 25 35 garbage
>> >> >
>> >> > how is it happening??
>> >> >
>> >> > --
>> >> > 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.
>> >> >
>> >> >
>> >>
>> >>
>> >> --
>> >> *Piyush Sinha*
>> >> *IIIT, Allahabad*
>> >> *+91-8792136657*
>> >> *+91-7483122727*
>> >> *https://www.facebook.com/profile.php?id=10655377926 *
>> >>
>> >> --
>> >> 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.
>> >
>> >
>>
>>
>> --
>> *Piyush Sinha*
>> *IIIT, Allahabad*
>> *+91-8792136657*
>> *+91-7483122727*
>> *https://www.facebook.com/profile.php?id=10655377926 *
>>
>> --
>> 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
>>

Re: [algogeeks] c doubt again

2011-06-23 Thread harshit pahuja
@rajeev

http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
http://www.cplusplus.com/reference/clibrary/cstdio/printf/

On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty wrote:

> @ Piyush Could u provide the link to some source , because i am still
> unclear about the above concept .
>
> Regards
> Rajeev N B
>
>
>
>
> On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha wrote:
>
>> there is no as such logic behind it..its just the format specifier...
>>
>> u must be knowing printf returns the number of values it has printed(u can
>> check that)
>>
>> now, in printf if u write like *printf("%7s","a"), *it will create 7
>> columns for the output and print a in the last column and the returned value
>> of this printf will be 7..(u can check it)
>>
>> now if u write *printf("%*s",7,"a")* then u r giving additional
>> information of format specifier i.e 7..returned value of this printf is also
>> 7.
>>
>> Hence the above logic..hope I am able to clarify it...:)
>>
>>
>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain wrote:
>>
>>> i mean how it working actually?
>>>
>>>
>>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain wrote:
>>>
 hey ya its working :) but whats the logic behind it??


 On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha >>> > wrote:

> sorry by mistake i added it in scanf situation..
> actually this type of specifier can be used with printf statement for
> finding the sum...
>
> look at the code below
>
> main()
> {
> int a=9;
> int b=3;
> printf("%d\n",printf("%*s%*s",a,"",b,""));
> system("pause");
> }
>
> On 6/23/11, Anika Jain  wrote:
> > thanx .. can u explain me how this is used in finding sum of 2 vars
> without
> > using + ??
> >
> >
> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
> > wrote:
> >
> >> An asterisk indicates that the data is to be retrieved from the use
> >> but ignored, i.e. it is not stored in the corresponding
> >> argument...hence the third value entered gets stored for b and for c
> >> the output comes to garbage value
> >>
> >> One beautiful application of such type of implementation is in
> finding
> >> the sum of 2 variables without using + operator..:)
> >>
> >> On 6/23/11, Anika Jain  wrote:
> >> > int main()
> >> > {
> >> >int a,b, c;
> >> >scanf("%d%*d%d",&a,&b,&c);
> >> >printf("%d %d %d",a,b,c);
> >> > }
> >> >
> >> > output: 25 35 garbage
> >> >
> >> > how is it happening??
> >> >
> >> > --
> >> > 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.
> >> >
> >> >
> >>
> >>
> >> --
> >> *Piyush Sinha*
> >> *IIIT, Allahabad*
> >> *+91-8792136657*
> >> *+91-7483122727*
> >> *https://www.facebook.com/profile.php?id=10655377926 *
> >>
> >> --
> >> 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.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> 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+un

Re: [algogeeks] c doubt again

2011-06-23 Thread rajeev bharshetty
@ Piyush Could u provide the link to some source , because i am still
unclear about the above concept .

Regards
Rajeev N B



On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha wrote:

> there is no as such logic behind it..its just the format specifier...
>
> u must be knowing printf returns the number of values it has printed(u can
> check that)
>
> now, in printf if u write like *printf("%7s","a"), *it will create 7
> columns for the output and print a in the last column and the returned value
> of this printf will be 7..(u can check it)
>
> now if u write *printf("%*s",7,"a")* then u r giving additional
> information of format specifier i.e 7..returned value of this printf is also
> 7.
>
> Hence the above logic..hope I am able to clarify it...:)
>
>
> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain wrote:
>
>> i mean how it working actually?
>>
>>
>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain wrote:
>>
>>> hey ya its working :) but whats the logic behind it??
>>>
>>>
>>> On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
>>> wrote:
>>>
 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf("%d\n",printf("%*s%*s",a,"",b,""));
 system("pause");
 }

 On 6/23/11, Anika Jain  wrote:
 > thanx .. can u explain me how this is used in finding sum of 2 vars
 without
 > using + ??
 >
 >
 > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
 > wrote:
 >
 >> An asterisk indicates that the data is to be retrieved from the use
 >> but ignored, i.e. it is not stored in the corresponding
 >> argument...hence the third value entered gets stored for b and for c
 >> the output comes to garbage value
 >>
 >> One beautiful application of such type of implementation is in
 finding
 >> the sum of 2 variables without using + operator..:)
 >>
 >> On 6/23/11, Anika Jain  wrote:
 >> > int main()
 >> > {
 >> >int a,b, c;
 >> >scanf("%d%*d%d",&a,&b,&c);
 >> >printf("%d %d %d",a,b,c);
 >> > }
 >> >
 >> > output: 25 35 garbage
 >> >
 >> > how is it happening??
 >> >
 >> > --
 >> > 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.
 >> >
 >> >
 >>
 >>
 >> --
 >> *Piyush Sinha*
 >> *IIIT, Allahabad*
 >> *+91-8792136657*
 >> *+91-7483122727*
 >> *https://www.facebook.com/profile.php?id=10655377926 *
 >>
 >> --
 >> 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.
 >
 >


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.
>>
>
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
>  --
> You received this message because you are subscribed to the Googl

Re: [algogeeks] c doubt

2011-06-23 Thread rajeev bharshetty
In C, the type of a character constant like 'a' is actually an int, with
size of 4. In C++, the type is char, with size of 1. This is one of many
small differences between the two languages.

On Thu, Jun 23, 2011 at 6:50 PM, piyush kapoor  wrote:

> You didn't understand my question...
> Why is sizeof() interpreting a "constant character literal" as ascii???
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 doubt again

2011-06-23 Thread Piyush Sinha
there is no as such logic behind it..its just the format specifier...

u must be knowing printf returns the number of values it has printed(u can
check that)

now, in printf if u write like *printf("%7s","a"), *it will create 7
columns for the output and print a in the last column and the returned value
of this printf will be 7..(u can check it)

now if u write *printf("%*s",7,"a")* then u r giving additional information
of format specifier i.e 7..returned value of this printf is also 7.

Hence the above logic..hope I am able to clarify it...:)

On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain  wrote:

> i mean how it working actually?
>
>
> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain wrote:
>
>> hey ya its working :) but whats the logic behind it??
>>
>>
>> On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
>> wrote:
>>
>>> sorry by mistake i added it in scanf situation..
>>> actually this type of specifier can be used with printf statement for
>>> finding the sum...
>>>
>>> look at the code below
>>>
>>> main()
>>> {
>>> int a=9;
>>> int b=3;
>>> printf("%d\n",printf("%*s%*s",a,"",b,""));
>>> system("pause");
>>> }
>>>
>>> On 6/23/11, Anika Jain  wrote:
>>> > thanx .. can u explain me how this is used in finding sum of 2 vars
>>> without
>>> > using + ??
>>> >
>>> >
>>> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
>>> > wrote:
>>> >
>>> >> An asterisk indicates that the data is to be retrieved from the use
>>> >> but ignored, i.e. it is not stored in the corresponding
>>> >> argument...hence the third value entered gets stored for b and for c
>>> >> the output comes to garbage value
>>> >>
>>> >> One beautiful application of such type of implementation is in finding
>>> >> the sum of 2 variables without using + operator..:)
>>> >>
>>> >> On 6/23/11, Anika Jain  wrote:
>>> >> > int main()
>>> >> > {
>>> >> >int a,b, c;
>>> >> >scanf("%d%*d%d",&a,&b,&c);
>>> >> >printf("%d %d %d",a,b,c);
>>> >> > }
>>> >> >
>>> >> > output: 25 35 garbage
>>> >> >
>>> >> > how is it happening??
>>> >> >
>>> >> > --
>>> >> > 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.
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >> --
>>> >> *Piyush Sinha*
>>> >> *IIIT, Allahabad*
>>> >> *+91-8792136657*
>>> >> *+91-7483122727*
>>> >> *https://www.facebook.com/profile.php?id=10655377926 *
>>> >>
>>> >> --
>>> >> 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.
>>> >
>>> >
>>>
>>>
>>> --
>>> *Piyush Sinha*
>>> *IIIT, Allahabad*
>>> *+91-8792136657*
>>> *+91-7483122727*
>>> *https://www.facebook.com/profile.php?id=10655377926 *
>>>
>>> --
>>> 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.
>



-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

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

2011-06-23 Thread Anika Jain
i mean how it working actually?

On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain  wrote:

> hey ya its working :) but whats the logic behind it??
>
>
> On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha wrote:
>
>> sorry by mistake i added it in scanf situation..
>> actually this type of specifier can be used with printf statement for
>> finding the sum...
>>
>> look at the code below
>>
>> main()
>> {
>> int a=9;
>> int b=3;
>> printf("%d\n",printf("%*s%*s",a,"",b,""));
>> system("pause");
>> }
>>
>> On 6/23/11, Anika Jain  wrote:
>> > thanx .. can u explain me how this is used in finding sum of 2 vars
>> without
>> > using + ??
>> >
>> >
>> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
>> > wrote:
>> >
>> >> An asterisk indicates that the data is to be retrieved from the use
>> >> but ignored, i.e. it is not stored in the corresponding
>> >> argument...hence the third value entered gets stored for b and for c
>> >> the output comes to garbage value
>> >>
>> >> One beautiful application of such type of implementation is in finding
>> >> the sum of 2 variables without using + operator..:)
>> >>
>> >> On 6/23/11, Anika Jain  wrote:
>> >> > int main()
>> >> > {
>> >> >int a,b, c;
>> >> >scanf("%d%*d%d",&a,&b,&c);
>> >> >printf("%d %d %d",a,b,c);
>> >> > }
>> >> >
>> >> > output: 25 35 garbage
>> >> >
>> >> > how is it happening??
>> >> >
>> >> > --
>> >> > 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.
>> >> >
>> >> >
>> >>
>> >>
>> >> --
>> >> *Piyush Sinha*
>> >> *IIIT, Allahabad*
>> >> *+91-8792136657*
>> >> *+91-7483122727*
>> >> *https://www.facebook.com/profile.php?id=10655377926 *
>> >>
>> >> --
>> >> 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.
>> >
>> >
>>
>>
>> --
>> *Piyush Sinha*
>> *IIIT, Allahabad*
>> *+91-8792136657*
>> *+91-7483122727*
>> *https://www.facebook.com/profile.php?id=10655377926 *
>>
>> --
>> 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 doubt again

2011-06-23 Thread harshit pahuja
@anika can u will please tell me the source of all dese questions,,

actually i am new to this all
nd getting to learn a lot..
thanks in anticipation

On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha wrote:

> sorry by mistake i added it in scanf situation..
> actually this type of specifier can be used with printf statement for
> finding the sum...
>
> look at the code below
>
> main()
> {
> int a=9;
> int b=3;
> printf("%d\n",printf("%*s%*s",a,"",b,""));
> system("pause");
> }
>
> On 6/23/11, Anika Jain  wrote:
> > thanx .. can u explain me how this is used in finding sum of 2 vars
> without
> > using + ??
> >
> >
> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
> > wrote:
> >
> >> An asterisk indicates that the data is to be retrieved from the use
> >> but ignored, i.e. it is not stored in the corresponding
> >> argument...hence the third value entered gets stored for b and for c
> >> the output comes to garbage value
> >>
> >> One beautiful application of such type of implementation is in finding
> >> the sum of 2 variables without using + operator..:)
> >>
> >> On 6/23/11, Anika Jain  wrote:
> >> > int main()
> >> > {
> >> >int a,b, c;
> >> >scanf("%d%*d%d",&a,&b,&c);
> >> >printf("%d %d %d",a,b,c);
> >> > }
> >> >
> >> > output: 25 35 garbage
> >> >
> >> > how is it happening??
> >> >
> >> > --
> >> > 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.
> >> >
> >> >
> >>
> >>
> >> --
> >> *Piyush Sinha*
> >> *IIIT, Allahabad*
> >> *+91-8792136657*
> >> *+91-7483122727*
> >> *https://www.facebook.com/profile.php?id=10655377926 *
> >>
> >> --
> >> 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.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> 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.
>
>


-- 
HARSHIT PAHUJA
M.N.N.I.T.
ALLAHABAD

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

2011-06-23 Thread Anika Jain
hey ya its working :) but whats the logic behind it??

On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha wrote:

> sorry by mistake i added it in scanf situation..
> actually this type of specifier can be used with printf statement for
> finding the sum...
>
> look at the code below
>
> main()
> {
> int a=9;
> int b=3;
> printf("%d\n",printf("%*s%*s",a,"",b,""));
> system("pause");
> }
>
> On 6/23/11, Anika Jain  wrote:
> > thanx .. can u explain me how this is used in finding sum of 2 vars
> without
> > using + ??
> >
> >
> > On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
> > wrote:
> >
> >> An asterisk indicates that the data is to be retrieved from the use
> >> but ignored, i.e. it is not stored in the corresponding
> >> argument...hence the third value entered gets stored for b and for c
> >> the output comes to garbage value
> >>
> >> One beautiful application of such type of implementation is in finding
> >> the sum of 2 variables without using + operator..:)
> >>
> >> On 6/23/11, Anika Jain  wrote:
> >> > int main()
> >> > {
> >> >int a,b, c;
> >> >scanf("%d%*d%d",&a,&b,&c);
> >> >printf("%d %d %d",a,b,c);
> >> > }
> >> >
> >> > output: 25 35 garbage
> >> >
> >> > how is it happening??
> >> >
> >> > --
> >> > 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.
> >> >
> >> >
> >>
> >>
> >> --
> >> *Piyush Sinha*
> >> *IIIT, Allahabad*
> >> *+91-8792136657*
> >> *+91-7483122727*
> >> *https://www.facebook.com/profile.php?id=10655377926 *
> >>
> >> --
> >> 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.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> 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 doubt again

2011-06-23 Thread Piyush Sinha
sorry by mistake i added it in scanf situation..
actually this type of specifier can be used with printf statement for
finding the sum...

look at the code below

main()
{
 int a=9;
 int b=3;
 printf("%d\n",printf("%*s%*s",a,"",b,""));
 system("pause");
}

On 6/23/11, Anika Jain  wrote:
> thanx .. can u explain me how this is used in finding sum of 2 vars without
> using + ??
>
>
> On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
> wrote:
>
>> An asterisk indicates that the data is to be retrieved from the use
>> but ignored, i.e. it is not stored in the corresponding
>> argument...hence the third value entered gets stored for b and for c
>> the output comes to garbage value
>>
>> One beautiful application of such type of implementation is in finding
>> the sum of 2 variables without using + operator..:)
>>
>> On 6/23/11, Anika Jain  wrote:
>> > int main()
>> > {
>> >int a,b, c;
>> >scanf("%d%*d%d",&a,&b,&c);
>> >printf("%d %d %d",a,b,c);
>> > }
>> >
>> > output: 25 35 garbage
>> >
>> > how is it happening??
>> >
>> > --
>> > 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.
>> >
>> >
>>
>>
>> --
>> *Piyush Sinha*
>> *IIIT, Allahabad*
>> *+91-8792136657*
>> *+91-7483122727*
>> *https://www.facebook.com/profile.php?id=10655377926 *
>>
>> --
>> 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.
>
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

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

2011-06-23 Thread Anika Jain
thanx .. can u explain me how this is used in finding sum of 2 vars without
using + ??


On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha wrote:

> An asterisk indicates that the data is to be retrieved from the use
> but ignored, i.e. it is not stored in the corresponding
> argument...hence the third value entered gets stored for b and for c
> the output comes to garbage value
>
> One beautiful application of such type of implementation is in finding
> the sum of 2 variables without using + operator..:)
>
> On 6/23/11, Anika Jain  wrote:
> > int main()
> > {
> >int a,b, c;
> >scanf("%d%*d%d",&a,&b,&c);
> >printf("%d %d %d",a,b,c);
> > }
> >
> > output: 25 35 garbage
> >
> > how is it happening??
> >
> > --
> > 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.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> 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 doubt again

2011-06-23 Thread Piyush Sinha
An asterisk indicates that the data is to be retrieved from the use
but ignored, i.e. it is not stored in the corresponding
argument...hence the third value entered gets stored for b and for c
the output comes to garbage value

One beautiful application of such type of implementation is in finding
the sum of 2 variables without using + operator..:)

On 6/23/11, Anika Jain  wrote:
> int main()
> {
>int a,b, c;
>scanf("%d%*d%d",&a,&b,&c);
>printf("%d %d %d",a,b,c);
> }
>
> output: 25 35 garbage
>
> how is it happening??
>
> --
> 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.
>
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

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

2011-06-23 Thread Anika Jain
int main()
{
   int a,b, c;
   scanf("%d%*d%d",&a,&b,&c);
   printf("%d %d %d",a,b,c);
}

output: 25 35 garbage

how is it happening??

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

2011-06-23 Thread piyush kapoor
You didn't understand my question...
Why is sizeof() interpreting a "constant character literal" as ascii???

-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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

2011-06-23 Thread rajeev bharshetty
@piyush Because of its interpretation as ascii .The character's ascii value
is taken into account which is an integer .

On Thu, Jun 23, 2011 at 6:32 PM, piyush kapoor  wrote:

> int main()
> {
> char a;
> printf("%d %d",sizeof(a),sizeof('a'));
> return 0;
> }
> Output:
> 1 4
>
> why does the expression sizeof('a') evaluates it as an integer,not as a
> character??
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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 doubt

2011-06-23 Thread piyush kapoor
int main()
{
char a;
printf("%d %d",sizeof(a),sizeof('a'));
return 0;
}
Output:
1 4

why does the expression sizeof('a') evaluates it as an integer,not as a
character??
-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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



  1   2   >