Re: [algogeeks] C output

2012-10-17 Thread Vikas Kumar
#include
int main()
{
   char str[]={'a','b','c'};
   char str1[]={"abc"};
  printf("%d",sizeof(str));
printf("%d",sizeof(str1));
getchar();
}

This is giving 3 in case of str and 4 in case of str1 bcz str is "array of
character" and str1 is a "string".
For understanding this point consider a integer array int arr[] =
{1,2,3,4}; then for this sizeof(arr) is 16 means 4*sizeof(int). So in the
same way for str in given program it is giving 3*sizeof(char) i.e. 3.

sizeof(anyString) = lengthOfString +1 ( +1 for '\0')
strlen(anyString)  = simple length
sizeof(anyArray) = numberofElementPresentInArray*sizeof(dataType)


-- 
*Thanks,*
*Vikas Kumar*
*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2012-10-08 Thread rahul sharma
@sachin..thnx for explanation..got it..plz tell

#include


int main()
{
   char str[]={'a','b','c'};
   char str1[]={"abc"};
  printf("%d",sizeof(str));
printf("%d",sizeof(str1));
getchar();
}



why str has size 3 and str1 has 4...NUll should also come after c of
str???then y 3??

On Mon, Oct 8, 2012 at 5:07 PM, Sachin  wrote:

> @rahul According to C specification, half filled array will be filled with
> value 0. In your example you are setting str[0] as 'g' and str[1] as 'k'.
> So the compiler sets str[29] as 0. So you string str becomes
> {'g', 'k', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'}
>
> Confusion is arising from the fact that you have created an array of 10
> elements.
>
> To answer you original question "gk" is inherently {'g', 'k', '\0'} and
> has size 3 while {'g', 'k'} has size 2.
>
> Regards,
> Sachin
>
>
> On Saturday, October 6, 2012 9:34:30 PM UTC+5:30, rahul sharma wrote:
>
>> #include
>>
>>
>> int main()
>> {
>> char str[10]={'g','k'};
>> char str1[10]="gh";
>> int i;
>> for(i=0;str1[i]!=NULL;i++)
>> printf("%c",str[i]);
>> getchar();
>> }
>>
>> NUll is there in character array also...make clear me...
>>
>> On Sat, Oct 6, 2012 at 9:22 PM, rahul sharma  wrote:
>>
>>> int main()
>>> {
>>> char str[10]={'g','k'};
>>> char str1[10]="gh";
>>>
>>>
>>> printf("%s",str);
>>> printf("%s",str1);
>>> getchar();
>>> }
>>> then how does this work???
>>> str printing gk...then NULL is automatically appended in this also...plz
>>> tell
>>>
>>>
>>> On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan wrote:
>>>
 For string, C appends '\0' internally. hence sizeof(str) returned the
 value 3.
 str1 is char array with two character. hence sizeof(str1) returned the
 value 2.

 --  RK :)


 On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma wrote:

> char str[]="ab";
> char str1[]={'a','b'};
>
> sizeof(str) ...o/p is 3
> sizeof(str1)o/p is 2..
>
> Why so
> plz explain...
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algo...@googlegroups.com.
> To unsubscribe from this group, send email to algogeeks+...@**
> 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 algo...@googlegroups.com.
 To unsubscribe from this group, send email to algogeeks+...@**
 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 view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/65EsWyTnMlEJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2012-10-08 Thread Sachin
@rahul According to C specification, half filled array will be filled with 
value 0. In your example you are setting str[0] as 'g' and str[1] as 'k'. 
So the compiler sets str[29] as 0. So you string str becomes
{'g', 'k', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'}

Confusion is arising from the fact that you have created an array of 10 
elements.

To answer you original question "gk" is inherently {'g', 'k', '\0'} and has 
size 3 while {'g', 'k'} has size 2.

Regards,
Sachin

On Saturday, October 6, 2012 9:34:30 PM UTC+5:30, rahul sharma wrote:
>
> #include
>
>
> int main()
> {
> char str[10]={'g','k'};
> char str1[10]="gh";
> int i;
> for(i=0;str1[i]!=NULL;i++)
> printf("%c",str[i]);
> getchar();
> }
>
> NUll is there in character array also...make clear me...
>
> On Sat, Oct 6, 2012 at 9:22 PM, rahul sharma 
> > wrote:
>
>> int main()
>> {
>> char str[10]={'g','k'};
>> char str1[10]="gh";
>>
>>
>> printf("%s",str);
>> printf("%s",str1);
>> getchar();
>> }
>> then how does this work???
>> str printing gk...then NULL is automatically appended in this also...plz 
>> tell
>>
>>
>> On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan 
>> 
>> > wrote:
>>
>>> For string, C appends '\0' internally. hence sizeof(str) returned the 
>>> value 3.
>>> str1 is char array with two character. hence sizeof(str1) returned the 
>>> value 2.
>>>
>>> --  RK :)
>>>
>>>
>>> On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma 
>>> 
>>> > wrote:
>>>
 char str[]="ab"; 
 char str1[]={'a','b'};

 sizeof(str) ...o/p is 3
 sizeof(str1)o/p is 2..

 Why so
 plz explain...
  
 -- 
 You received this message because you are subscribed to the Google 
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algo...@googlegroups.com
 .
 To unsubscribe from this group, send email to 
 algogeeks+...@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 algo...@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to 
>>> algogeeks+...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/65EsWyTnMlEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2012-10-06 Thread rahul sharma
#include


int main()
{
char str[10]={'g','k'};
char str1[10]="gh";
int i;
for(i=0;str1[i]!=NULL;i++)
printf("%c",str[i]);
getchar();
}

NUll is there in character array also...make clear me...

On Sat, Oct 6, 2012 at 9:22 PM, rahul sharma wrote:

> int main()
> {
> char str[10]={'g','k'};
> char str1[10]="gh";
>
>
> printf("%s",str);
> printf("%s",str1);
> getchar();
> }
> then how does this work???
> str printing gk...then NULL is automatically appended in this also...plz
> tell
>
>
> On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan wrote:
>
>> For string, C appends '\0' internally. hence sizeof(str) returned the
>> value 3.
>> str1 is char array with two character. hence sizeof(str1) returned the
>> value 2.
>>
>> --  RK :)
>>
>>
>> On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma wrote:
>>
>>> char str[]="ab";
>>> char str1[]={'a','b'};
>>>
>>> sizeof(str) ...o/p is 3
>>> sizeof(str1)o/p is 2..
>>>
>>> Why so
>>> plz 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 output

2012-10-06 Thread rahul sharma
int main()
{
char str[10]={'g','k'};
char str1[10]="gh";


printf("%s",str);
printf("%s",str1);
getchar();
}
then how does this work???
str printing gk...then NULL is automatically appended in this also...plz
tell


On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan wrote:

> For string, C appends '\0' internally. hence sizeof(str) returned the
> value 3.
> str1 is char array with two character. hence sizeof(str1) returned the
> value 2.
>
> --  RK :)
>
>
> On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma wrote:
>
>> char str[]="ab";
>> char str1[]={'a','b'};
>>
>> sizeof(str) ...o/p is 3
>> sizeof(str1)o/p is 2..
>>
>> Why so
>> plz 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 output

2012-10-06 Thread Jaspreet Singh
because of null char in 1st

On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma wrote:

> char str[]="ab";
> char str1[]={'a','b'};
>
> sizeof(str) ...o/p is 3
> sizeof(str1)o/p is 2..
>
> Why so
> plz 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 output

2012-10-06 Thread Rathish Kannan
For string, C appends '\0' internally. hence sizeof(str) returned the value
3.
str1 is char array with two character. hence sizeof(str1) returned the
value 2.

--  RK :)


On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma wrote:

> char str[]="ab";
> char str1[]={'a','b'};
>
> sizeof(str) ...o/p is 3
> sizeof(str1)o/p is 2..
>
> Why so
> plz 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.



[algogeeks] C output

2012-10-06 Thread rahul sharma
char str[]="ab";
char str1[]={'a','b'};

sizeof(str) ...o/p is 3
sizeof(str1)o/p is 2..

Why so
plz 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 output

2012-07-03 Thread atul anand
violation of sequence point ruleoutput depends on compiler to compiler.

On Tue, Jul 3, 2012 at 1:22 PM, rahul sharma wrote:

> #include
> #include
> int main()
> {
> int i;
> i=5;
> i=++i/i++;
> printf("%d",i);
> getch();
> }
>
> Why o/p is 1 and not 2??   what happened for post increment???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2012-07-03 Thread rahul sharma
#include
#include
int main()
{
int i;
i=5;
i=++i/i++;
printf("%d",i);
getch();
}

Why o/p is 1 and not 2??   what happened for post increment???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2012-01-16 Thread payal gupta
i gues atul is crkt.
its jst printin by user convenience...when actually d two are not equal...

i guess the code...xplains well...dats y "equal " is not printed..out


#includeint main(){
   double p=fabs(24.9996);
   printf("%lf\n",p);
   double t=fabs(25.0003);
   printf("%lf\n",t);
   printf("%0.3lf %0.3lf\n",p,t);
   printf("%lf\n%lf\n",fabs(p),fabs(t));
   if(fabs(p)==fabs(t))
   printf("equal");// why this not executed?}


crkt me if i'm wrong..
Regards,
PAYAL GUPTA,
NIT-BHOPAL..
On Tue, Jan 17, 2012 at 12:13 PM, shady  wrote:

> atul he is assigning the value later on.
> i think format specifier . rounds up the number in last decimal place.
>
>
> On Tue, Jan 17, 2012 at 11:53 AM, atul anand wrote:
>
>> printf("%0.3lf %0.3lf\n",p,t);
>>
>> its just printing at your convenience . you are not changing the value of
>> p,t .
>> change this statement to
>> printf("%0.5lf %0.5lf\n",p,t);
>>
>>
>>
>>
>> On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers 
>> wrote:
>>
>>> #include
>>> int main()
>>> {
>>>double p=fabs(24.9996);
>>>double t=fabs(25.0003);
>>>printf("%0.3lf %0.3lf\n",p,t);
>>>if(fabs(p)==fabs(t))
>>>printf("equal");// why this not executed?
>>> }
>>>
>>>
>>> why the "equal" not printed in this code...?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2012-01-16 Thread Rujin Cao
It's not a good way to compare two floats directly using =, try something
like below:

http://ideone.com/c65Vl

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2012-01-16 Thread shady
atul he is assigning the value later on.
i think format specifier . rounds up the number in last decimal place.

On Tue, Jan 17, 2012 at 11:53 AM, atul anand wrote:

> printf("%0.3lf %0.3lf\n",p,t);
>
> its just printing at your convenience . you are not changing the value of
> p,t .
> change this statement to
> printf("%0.5lf %0.5lf\n",p,t);
>
>
>
>
> On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers 
> wrote:
>
>> #include
>> int main()
>> {
>>double p=fabs(24.9996);
>>double t=fabs(25.0003);
>>printf("%0.3lf %0.3lf\n",p,t);
>>if(fabs(p)==fabs(t))
>>printf("equal");// why this not executed?
>> }
>>
>>
>> why the "equal" not printed in this code...?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2012-01-16 Thread atul anand
printf("%0.3lf %0.3lf\n",p,t);

its just printing at your convenience . you are not changing the value of
p,t .
change this statement to
printf("%0.5lf %0.5lf\n",p,t);



On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers wrote:

> #include
> int main()
> {
>double p=fabs(24.9996);
>double t=fabs(25.0003);
>printf("%0.3lf %0.3lf\n",p,t);
>if(fabs(p)==fabs(t))
>printf("equal");// why this not executed?
> }
>
>
> why the "equal" not printed in this code...?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2012-01-16 Thread dabbcomputers
#include
int main()
{
double p=fabs(24.9996);
double t=fabs(25.0003);
printf("%0.3lf %0.3lf\n",p,t);
if(fabs(p)==fabs(t))
printf("equal");// why this not executed?
}


why the "equal" not printed in this code...?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output ??

2012-01-10 Thread saurabh singh
It's painful to see printf being accused for the (un) expected
output..The declaration of printf means that any data type can be
passed to it as argument.Inherently what printf does is print the bytes in
meaningful form according to the first argument which is a string.So its
impossible for printf to typecast arguments once they are passed they
appear the same way to printf...*A stream of bits from which it has to
extract the valid info.*Its the responsibility of the programmer to pass
the right data type with right format specifier...Just to complete my
answer http://www.ideone.com/CNkCo .
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Tue, Jan 10, 2012 at 2:29 PM, Rahul Verma wrote:

> @amol this is not the behaviour of printf, its totally about the
> typecasting
>
>  --
> 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/-/GPVlt15S3V0J.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output ??

2012-01-10 Thread Rahul Verma
@amol this is not the behaviour of printf, its totally about the typecasting

-- 
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/-/GPVlt15S3V0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output ??

2012-01-09 Thread Kartik Sachan
@amol I think  it is not the behaviour of printf

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output ??

2012-01-09 Thread Amol Sharma
According to K&R the behavior of printf is undefined if u do not use
correct format specifiers for the variables.
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
 








On Mon, Jan 9, 2012 at 11:01 AM, atul anand  wrote:

> take care when ever you use %d and %f
>
> %d is not flexible in handling float varibaledo not expect it to
> typecast itself.
> reason could be , you are trying to fit large data type i.e float to  the
> int whose range is less.
>
> whereas in second case float can incorporate int type , so automatic
> typecasting is done.
>
>
> On Mon, Jan 9, 2012 at 10:17 AM, HARSHIT PAHUJA 
> wrote:
>
>> *#include
>> int main()
>> {
>> float f=25.25;
>> printf("%d\n",f);
>> long int x=90;
>> printf("%f",x);
>> return 0;
>> }
>> *
>>
>> above program gives output
>> *0
>> 25.25*
>>
>> shudn it be :
>> *25
>> 90.*
>>  ??
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output ??

2012-01-08 Thread atul anand
take care when ever you use %d and %f

%d is not flexible in handling float varibaledo not expect it to
typecast itself.
reason could be , you are trying to fit large data type i.e float to  the
int whose range is less.

whereas in second case float can incorporate int type , so automatic
typecasting is done.

On Mon, Jan 9, 2012 at 10:17 AM, HARSHIT PAHUJA wrote:

> *#include
> int main()
> {
> float f=25.25;
> printf("%d\n",f);
> long int x=90;
> printf("%f",x);
> return 0;
> }
> *
>
> above program gives output
> *0
> 25.25*
>
> shudn it be :
> *25
> 90.*
>  ??
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output ??

2012-01-08 Thread HARSHIT PAHUJA
*#include
int main()
{
float f=25.25;
printf("%d\n",f);
long int x=90;
printf("%f",x);
return 0;
}
*

above program gives output
*0
25.25*

shudn it be :
*25
90.*
 ??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2012-01-06 Thread sravanreddy001
@arun:  http://mindprod.com/jgloss/immutable.html
this might help you, in essense, if a compiler treats them as immutable, 
the reason is to reduce the overhead of creating another contant literal 
(as explain at the link, the string literals are the most commonly used)

this is from a java (or higher than C languages) just got to know that this 
is in C too...

-- 
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/-/vcZVkFcVEwoJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2012-01-05 Thread UTKARSH SRIVASTAV
saurabh is right it is compiler dependent c makers have left this issue
undefined.

On Thu, Jan 5, 2012 at 7:44 PM, teja bala  wrote:

> depends on compiler i think..but most probably it compares the
> addresses.
>
>
> On Wed, Jan 4, 2012 at 12:20 PM, saurabh singh wrote:
>
>> @all.Your explanations work because probably all of you are using a
>> compiler that's behaving in the same way.Don't conclude from what you
>> see...The compiler is free to store the constant strings the way it
>> wants.
>> Saurabh Singh
>> B.Tech (Computer Science)
>> MNNIT
>> blog:geekinessthecoolway.blogspot.com
>>
>>
>>
>> On Wed, Jan 4, 2012 at 12:13 PM, Rahul  wrote:
>>
>>> it's near to a common mis conception that string liberals are in data
>>> sections of THE PROGRAM
>>>
>>>
>>> PLEASE READ THE FILE
>>> a.out.h
>>>
>>> and find the difference between initialized data and non initialized data
>>>
>>> On 9/6/11, Sandy  wrote:
>>> > String constants (literals) are saved into the .data section of the
>>> program,
>>> >  Here is the sample program to show that.  if() is essentially
>>> comparing the
>>> > addresses of two pointers which is same.
>>> >
>>> > int main()
>>> > {
>>> > char *p="persons";
>>> > char *q="persons";
>>> > char *r="persons";
>>> > char *s="persons";
>>> >  printf("%x %x %x %x\n",p,q,r,s);
>>> > if(p=="persons")
>>> > printf("technical %s",p);
>>> > else
>>> > printf("true %s",p);
>>> > return 0;
>>> > }
>>> > -
>>> > Output:
>>> > 403021 403021 403021 403021
>>> > technical persons
>>> >
>>> > On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s >> >wrote:
>>> >
>>> >>
>>> >> main()
>>> >> {
>>> >> char *p="persons";
>>> >> clrscr();
>>> >> if(p=="persons")
>>> >> printf("technical %s",p);
>>> >> else
>>> >> printf("true %s",p);
>>> >> return 0;
>>> >> }
>>> >>
>>> >> ..op : technical persons ..plz explain .. how come it works like an
>>> strcmp
>>> >> operation???
>>> >> --
>>> >> Regards,
>>> >> $iva
>>> >>
>>> >>  --
>>> >> You received this message because you are subscribed to the Google
>>> Groups
>>> >> "Algorithm Geeks" group.
>>> >> To post to this group, send email to algogeeks@googlegroups.com.
>>> >> To unsubscribe from this group, send email to
>>> >> algogeeks+unsubscr...@googlegroups.com.
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/algogeeks?hl=en.
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> >
>>> > *Sandeep Kumar,*
>>> >  ( Mobile +91-9866507368
>>> >
>>> > *“I believe in smart work, Believe Me”*
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Algorithm Geeks" group.
>>> > To post to this group, send email to algogeeks@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > algogeeks+unsubscr...@googlegroups.com.
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/algogeeks?hl=en.
>>> >
>>> >
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



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



Re: [algogeeks] C output????

2012-01-05 Thread teja bala
depends on compiler i think..but most probably it compares the
addresses.

On Wed, Jan 4, 2012 at 12:20 PM, saurabh singh  wrote:

> @all.Your explanations work because probably all of you are using a
> compiler that's behaving in the same way.Don't conclude from what you
> see...The compiler is free to store the constant strings the way it
> wants.
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT
> blog:geekinessthecoolway.blogspot.com
>
>
>
> On Wed, Jan 4, 2012 at 12:13 PM, Rahul  wrote:
>
>> it's near to a common mis conception that string liberals are in data
>> sections of THE PROGRAM
>>
>>
>> PLEASE READ THE FILE
>> a.out.h
>>
>> and find the difference between initialized data and non initialized data
>>
>> On 9/6/11, Sandy  wrote:
>> > String constants (literals) are saved into the .data section of the
>> program,
>> >  Here is the sample program to show that.  if() is essentially
>> comparing the
>> > addresses of two pointers which is same.
>> >
>> > int main()
>> > {
>> > char *p="persons";
>> > char *q="persons";
>> > char *r="persons";
>> > char *s="persons";
>> >  printf("%x %x %x %x\n",p,q,r,s);
>> > if(p=="persons")
>> > printf("technical %s",p);
>> > else
>> > printf("true %s",p);
>> > return 0;
>> > }
>> > -
>> > Output:
>> > 403021 403021 403021 403021
>> > technical persons
>> >
>> > On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s > >wrote:
>> >
>> >>
>> >> main()
>> >> {
>> >> char *p="persons";
>> >> clrscr();
>> >> if(p=="persons")
>> >> printf("technical %s",p);
>> >> else
>> >> printf("true %s",p);
>> >> return 0;
>> >> }
>> >>
>> >> ..op : technical persons ..plz explain .. how come it works like an
>> strcmp
>> >> operation???
>> >> --
>> >> Regards,
>> >> $iva
>> >>
>> >>  --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Algorithm Geeks" group.
>> >> To post to this group, send email to algogeeks@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> algogeeks+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/algogeeks?hl=en.
>> >>
>> >
>> >
>> >
>> > --
>> >
>> > *Sandeep Kumar,*
>> >  ( Mobile +91-9866507368
>> >
>> > *“I believe in smart work, Believe Me”*
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algogeeks@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > algogeeks+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C output????

2012-01-03 Thread saurabh singh
@all.Your explanations work because probably all of you are using a
compiler that's behaving in the same way.Don't conclude from what you
see...The compiler is free to store the constant strings the way it
wants.
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Wed, Jan 4, 2012 at 12:13 PM, Rahul  wrote:

> it's near to a common mis conception that string liberals are in data
> sections of THE PROGRAM
>
>
> PLEASE READ THE FILE
> a.out.h
>
> and find the difference between initialized data and non initialized data
>
> On 9/6/11, Sandy  wrote:
> > String constants (literals) are saved into the .data section of the
> program,
> >  Here is the sample program to show that.  if() is essentially comparing
> the
> > addresses of two pointers which is same.
> >
> > int main()
> > {
> > char *p="persons";
> > char *q="persons";
> > char *r="persons";
> > char *s="persons";
> >  printf("%x %x %x %x\n",p,q,r,s);
> > if(p=="persons")
> > printf("technical %s",p);
> > else
> > printf("true %s",p);
> > return 0;
> > }
> > -
> > Output:
> > 403021 403021 403021 403021
> > technical persons
> >
> > On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s  >wrote:
> >
> >>
> >> main()
> >> {
> >> char *p="persons";
> >> clrscr();
> >> if(p=="persons")
> >> printf("technical %s",p);
> >> else
> >> printf("true %s",p);
> >> return 0;
> >> }
> >>
> >> ..op : technical persons ..plz explain .. how come it works like an
> strcmp
> >> operation???
> >> --
> >> Regards,
> >> $iva
> >>
> >>  --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> >
> >
> > --
> >
> > *Sandeep Kumar,*
> >  ( Mobile +91-9866507368
> >
> > *“I believe in smart work, Believe Me”*
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from 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 output????

2012-01-03 Thread Rahul
it's near to a common mis conception that string liberals are in data
sections of THE PROGRAM


PLEASE READ THE FILE
a.out.h

and find the difference between initialized data and non initialized data

On 9/6/11, Sandy  wrote:
> String constants (literals) are saved into the .data section of the program,
>  Here is the sample program to show that.  if() is essentially comparing the
> addresses of two pointers which is same.
>
> int main()
> {
> char *p="persons";
> char *q="persons";
> char *r="persons";
> char *s="persons";
>  printf("%x %x %x %x\n",p,q,r,s);
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
> -
> Output:
> 403021 403021 403021 403021
> technical persons
>
> On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:
>
>>
>> main()
>> {
>> char *p="persons";
>> clrscr();
>> if(p=="persons")
>> printf("technical %s",p);
>> else
>> printf("true %s",p);
>> return 0;
>> }
>>
>> ..op : technical persons ..plz explain .. how come it works like an strcmp
>> operation???
>> --
>> Regards,
>> $iva
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
> *Sandeep Kumar,*
>  ( Mobile +91-9866507368
>
> *“I believe in smart work, Believe Me”*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output????

2012-01-03 Thread Arun Vishwanathan
actually is there any reason as to why same address is returned to the
pointer when both pointers(p and q) are initialised to "persons" unlike
when p[] and q[] ="persons"?

On Tue, Sep 6, 2011 at 9:08 AM, Sandy  wrote:

> String constants (literals) are saved into the .data section of the
> program,  Here is the sample program to show that.  if() is essentially
> comparing the addresses of two pointers which is same.
>
> int main()
> {
> char *p="persons";
> char *q="persons";
>  char *r="persons";
> char *s="persons";
>  printf("%x %x %x %x\n",p,q,r,s);
> if(p=="persons")
> printf("technical %s",p);
>  else
> printf("true %s",p);
> return 0;
> }
> -
> Output:
> 403021 403021 403021 403021
> technical persons
>
> On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:
>
>>
>> main()
>> {
>> char *p="persons";
>> clrscr();
>> if(p=="persons")
>> printf("technical %s",p);
>> else
>> printf("true %s",p);
>> return 0;
>> }
>>
>> ..op : technical persons ..plz explain .. how come it works like an
>> strcmp operation???
>> --
>> Regards,
>> $iva
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
> *Sandeep Kumar,*
>  ( Mobile +91-9866507368
>
> *“I believe in smart work, Believe Me”*
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



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

2011-10-29 Thread Anika Jain
yes 5 will be printed with 99 extra padding spaces.

On Sat, Oct 29, 2011 at 4:16 PM, rahul sharma wrote:

> does y goes to d of %*d and it print 5???i hav a doubt
>
>
> On Fri, Oct 28, 2011 at 9:32 PM, amrit harry wrote:
>
>> let this statement int x=100,y=5;printf("%*d",x,y);
>> in this line first x is assign to '*' and it become "%100d"
>> and it will padd 100 spaces before print. and if we use( "%*d",x)
>> then x is assign to '*' and garbage value wud be printed.
>>
>>
>> On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru 
>> wrote:
>>
>>> can u plz tell me what exactly %*d  means?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> AMRIT
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2011-10-29 Thread rahul sharma
does y goes to d of %*d and it print 5???i hav a doubt

On Fri, Oct 28, 2011 at 9:32 PM, amrit harry wrote:

> let this statement int x=100,y=5;printf("%*d",x,y);
> in this line first x is assign to '*' and it become "%100d"
> and it will padd 100 spaces before print. and if we use( "%*d",x)
> then x is assign to '*' and garbage value wud be printed.
>
>
> On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru 
> wrote:
>
>> can u plz tell me what exactly %*d  means?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> AMRIT
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-10-28 Thread amrit harry
let this statement int x=100,y=5;printf("%*d",x,y);
in this line first x is assign to '*' and it become "%100d"
and it will padd 100 spaces before print. and if we use( "%*d",x)
then x is assign to '*' and garbage value wud be printed.

On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru wrote:

> can u plz tell me what exactly %*d  means?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
AMRIT

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-10-28 Thread annarao kataru
can u plz tell me what exactly %*d  means?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-10-08 Thread shiva@Algo
This is what you use if you want *scanf()* to eat some data but you don't
want to store it anywhere; you don't give *scanf()* an argument for this
conversion

On Sun, Oct 9, 2011 at 1:32 AM, shiva@Algo  wrote:

> as expected value 100 goes to a,since %*d is variable field width specifier
>  so the input 200 goes for that,and the remaining input 300 goes to b
> value of c is not change
> so the output will be:
> 100 300 3
>
>
> On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg wrote:
>
>> *explain the o/p...if i/p are 100 200 300
>> int main()
>>   {
>>int a=1,b=2,c=3;
>>scanf("%d %*d %d",&a,&b,&c);
>>printf("%d %d %d",a,b,c);
>>return(0);
>>   }
>> *Thanking you
>>
>> *With regards-
>> Raghav garg
>> Contact no. 9013201944
>> www.facebook.com/rock.raghavag
>> B. tech (IT), 5th sem
>> University School Of Information Technology
>> Guru Govind Singh Indraprastha University
>> 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 output

2011-10-08 Thread shiva@Algo
as expected value 100 goes to a,since %*d is variable field width specifier
 so the input 200 goes for that,and the remaining input 300 goes to b
value of c is not change
so the output will be:
100 300 3

On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg wrote:

> *explain the o/p...if i/p are 100 200 300
> int main()
>   {
>int a=1,b=2,c=3;
>scanf("%d %*d %d",&a,&b,&c);
>printf("%d %d %d",a,b,c);
>return(0);
>   }
> *Thanking you
>
> *With regards-
> Raghav garg
> Contact no. 9013201944
> www.facebook.com/rock.raghavag
> B. tech (IT), 5th sem
> University School Of Information Technology
> Guru Govind Singh Indraprastha University
> 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.



[algogeeks] c output

2011-10-08 Thread Raghav Garg
*explain the o/p...if i/p are 100 200 300
int main()
  {
   int a=1,b=2,c=3;
   scanf("%d %*d %d",&a,&b,&c);
   printf("%d %d %d",a,b,c);
   return(0);
  }
*Thanking you

*With regards-
Raghav garg
Contact no. 9013201944
www.facebook.com/rock.raghavag
B. tech (IT), 5th sem
University School Of Information Technology
Guru Govind Singh Indraprastha University
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 OUTPUT

2011-09-22 Thread Pradip Singh
number will be sored in 2'scomplement form .as 4=100 so its 1's comlement
form will be 011 and adding  1 to it will result in 011+1=100.so -4 will be
printed

On Wed, Sep 21, 2011 at 10:23 AM, kartik sachan wrote:

> @ravi i think ur concepts is correct the no is stored in 2's formif
> negative
>
> thanks ravi
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 OUTPUT

2011-09-21 Thread kartik sachan
@ravi i think ur concepts is correct the no is stored in 2's formif
negative

thanks ravi

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 OUTPUT

2011-09-21 Thread ravi maggon
output is -4 -1
int a:1 signifies that only 1 bit will be stored for a and since we have
only 1 bit so it will serve as sign bit and we get obj.a as -1
similarly for int b:3, 3 bits will be used to store b. 12 is 1100. we save
only 3 bits i.e. 100 where msb signifies the sign i.e. no. is negative. But
I am not able to represent the value -4 in 3 bits. Can anyone elaborate?
I think 00 is getting converted to 2's complement which is 100 = 4 and we
have negative sign bit set. So ans is -4. Correct me if I am wrong.

On Wed, Sep 21, 2011 at 10:22 PM, kartik sachan wrote:

>
> int main(){
> struct {
> int a:1;
> int b:3;
> }obj;
> obj.b=12;
> obj.a=7;
> printf 
> ("%d 
> %d",obj.b,obj.a);return 0;}
>
>
>
> can anybody explain the output
> plzz also show how no's are stored
>
>
> --
>
> *WITH REGARDS,*
> *
> *
> *KARTIK SACHAN*
>
> *B.TECH 3rd YEAR*
> *COMPUTER SCIENCE AND ENGINEERING*
> *NIT 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.
>



-- 
Regards
Ravi Maggon
B.E. CSE, Final Year
Thapar University

www.algorithmguru.com

"*Failure is the opportunity to begin again more intelligently"*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 OUTPUT

2011-09-21 Thread kartik sachan
int main(){
struct {
int a:1;
int b:3;
}obj;
obj.b=12;
obj.a=7;
printf 
("%d
%d",obj.b,obj.a);return 0;}



can anybody explain the output
plzz also show how no's are stored


-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT 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 output

2011-09-19 Thread sukran dhawan
common guys its undefined acc to standard c 

On Mon, Sep 19, 2011 at 12:36 PM, Siddhartha Banerjee <
thefourrup...@gmail.com> wrote:

> on running,every time i get  second a=30... any reasons for that???
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-09-19 Thread Siddhartha Banerjee
on running,every time i get  second a=30... any reasons for that???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output,printf("%llx")

2011-09-18 Thread wujin chen
sorry , it should be :

usigned long long c = 0x12345678;
int a = 0x09;
int b = 0x10;
printf("a=%x, b=%llx",a,b,c);


2011/9/19 sagar pareek 

> Check out what u have written...
>
>
> On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wrote:
>
>> usigned long long x = 0x12345678;
>> int a = 0x09;
>> int b = 0x10;
>> printf("a=%x, b=%llx",a,b,c);
>>
>> the result is: a=9,b=123456780010
>>
>> i wonder why~~
>>
>> can anyone explain it?
>> thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output,printf("%llx")

2011-09-18 Thread sagar pareek
Check out what u have written...


On Sun, Sep 18, 2011 at 7:17 PM, wujin chen  wrote:

> usigned long long x = 0x12345678;
> int a = 0x09;
> int b = 0x10;
> printf("a=%x, b=%llx",a,b,c);
>
> the result is: a=9,b=123456780010
>
> i wonder why~~
>
> can anyone explain it?
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT 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 output,printf("%llx")

2011-09-18 Thread wujin chen
usigned long long x = 0x12345678;
int a = 0x09;
int b = 0x10;
printf("a=%x, b=%llx",a,b,c);

the result is: a=9,b=123456780010

i wonder why~~

can anyone explain it?
thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread sukran dhawan
again undefined in standard c :)

On Sun, Sep 18, 2011 at 1:49 PM, Bhavesh agrawal wrote:

> another que..
>
>
> #include
> main()
> {
> int a;
> int i=10;
> printf("%d %d %d\n",i+++i,i,i---i);
> printf("%d\n",i---i);
> a=i---i;
> printf("%d \n%d",a,i);
> return 0;
> }
>
> output:
>
> 18 10 0
> 0
> 0
> 8
>
> 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 output

2011-09-18 Thread Bhavesh agrawal
another que..

#include
main()
{
int a;
int i=10;
printf("%d %d %d\n",i+++i,i,i---i);
printf("%d\n",i---i);
a=i---i;
printf("%d \n%d",a,i);
return 0;
}

output:

18 10 0
0
0
8

how ??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread Saravana kumar
0 this is fisrt a:
0 this is second a:

On Sun, Sep 18, 2011 at 12:09 PM, hurtlocker wrote:

> #include
>
> main()
>
> {
>
> int a ;
>
> a=abc();
>
> printf("\n %d this is fisrt a:",a);
>
> a=abc();
>
> printf("\n %d this is second a:",a);
>
> }
> int abc()
>
> {
>
> int i=23;
>
> if(1>0)
>
> return ;
>
> i++;
>
> return(++ i);
>
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this 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 output

2011-09-18 Thread Anup Ghatage
Error.
the 1>0 condition does not return anything, while the function should return
an int.

On Sun, Sep 18, 2011 at 6:39 AM, hurtlocker wrote:

> #include
>
> main()
>
> {
>
> int a ;
>
> a=abc();
>
> printf("\n %d this is fisrt a:",a);
>
> a=abc();
>
> printf("\n %d this is second a:",a);
>
> }
> int abc()
>
> {
>
> int i=23;
>
> if(1>0)
>
> return ;
>
> i++;
>
> return(++ i);
>
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-18 Thread Bhavesh agrawal
result is this

 -1075990972 this is fisrt a:
 30 this is second a

what is the meaning of a=30 in second call

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-18 Thread kartik sachan
@what's special in this ...
it is giving 0 in both cases.
basically a garbage value

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-18 Thread Amol Sharma
it is just printing some garbage value as u have specified return but not
the value.try putting some value with return then you'll understand
what's happening..
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad







On Sun, Sep 18, 2011 at 12:38 PM, sukran dhawan wrote:

> result is not defined by standard c. It doesnt produce compiler error just
> because return type is int and no value is returned in if(1>0)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-18 Thread sukran dhawan
result is not defined by standard c. It doesnt produce compiler error just
because return type is int and no value is returned in if(1>0)
basically garbage

On Sun, Sep 18, 2011 at 12:23 PM, Bhavesh agrawal wrote:

> #include
>
> main()
>
> {
>
> int a ;
>
> a=abc();
>
> printf("\n %d this is fisrt a:",a);
>
> a=abc();
>
> printf("\n %d this is second a:",a);
>
> }
> int abc()
>
> {
>
> int i=23;
>
> if(1>0)
>
> return ;
>
> i++;
>
> return(++ i);
>
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this 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 output

2011-09-17 Thread Bhavesh agrawal
#include

main()

{

int a ;

a=abc();

printf("\n %d this is fisrt a:",a);

a=abc();

printf("\n %d this is second a:",a);

}
int abc()

{

int i=23;

if(1>0)

return ;

i++;

return(++ i);

}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this 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 output

2011-09-17 Thread hurtlocker
#include

main()

{

int a ;

a=abc();

printf("\n %d this is fisrt a:",a);

a=abc();

printf("\n %d this is second a:",a);

}
int abc()

{

int i=23;

if(1>0)

return ;

i++;

return(++ i);

}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this 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 output

2011-09-14 Thread tech coder
@ prateek absolutely wrong , dear u need to brushup ur basics d is a pointer
,
it's can be 2 or 4 depebding on compiler

On Wed, Sep 14, 2011 at 6:26 AM, PRATEEK VERMA  wrote:

> 9 and 3
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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*
*"The Coder"*

*"Life is a Game. The more u play, the more u win, the more u win , the more
successfully u play"*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-14 Thread PRATEEK VERMA
9 and 3

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-14 Thread Rohit Upadhyaya
for a 32 bit it is 4 ,3 and for 16 bit it is 2,3 and 64 bit it is 8,3..
also strlen(d) gives 3 bcz the coding of fn strlen() is such that as it
encounters null it will terminate..so irrespective of machine it prints 3 as
null at 4th place

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-13 Thread tech coder
for 16 bit compiler ans is 2  3
for 32 bit compiler ans is 4 3

pls correct me if i m wrong

On Wed, Sep 14, 2011 at 11:36 AM, tech coder wrote:

> +1
>
> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH wrote:
>
>> its 4 3   i think
>>
>>
>> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>>
>>> 8 3
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>>
 output??

 int main()
 {
 char *d = "abc\0def\0";
 printf("%d %d",sizeof(d),strlen(d));
 getch();
 }

 --
 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/-/nf_M_Yoep_EJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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 output

2011-09-13 Thread tech coder
+1

On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH wrote:

> its 4 3   i think
>
>
> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>
>> 8 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output .. help plz

2011-09-06 Thread sukran dhawan
coz both floating point are stored in ieee format which is different from
integers

On Tue, Sep 6, 2011 at 10:18 PM, sukran dhawan wrote:

> it wil not truncate the floating point to integer remember...
>
>
> On Tue, Sep 6, 2011 at 9:55 PM, sivaviknesh s wrote:
>
>> printf("%d",3.14*6.25*6.25);
>>
>> ...ans : 0 ..how and why?? why not type conversion take place??
>>
>> --
>> Regards,
>> $iva
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output .. help plz

2011-09-06 Thread sukran dhawan
it wil not truncate the floating point to integer remember...

On Tue, Sep 6, 2011 at 9:55 PM, sivaviknesh s wrote:

> printf("%d",3.14*6.25*6.25);
>
> ...ans : 0 ..how and why?? why not type conversion take place??
>
> --
> Regards,
> $iva
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output .. help plz

2011-09-06 Thread sivaviknesh s
 printf("%d",3.14*6.25*6.25);

...ans : 0 ..how and why?? why not type conversion take place??

-- 
Regards,
$iva

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2011-09-06 Thread Sandy
String constants (literals) are saved into the .data section of the program,
 Here is the sample program to show that.  if() is essentially comparing the
addresses of two pointers which is same.

int main()
{
char *p="persons";
char *q="persons";
char *r="persons";
char *s="persons";
 printf("%x %x %x %x\n",p,q,r,s);
if(p=="persons")
printf("technical %s",p);
else
printf("true %s",p);
return 0;
}
-
Output:
403021 403021 403021 403021
technical persons

On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:

>
> main()
> {
> char *p="persons";
> clrscr();
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
>
> ..op : technical persons ..plz explain .. how come it works like an strcmp
> operation???
> --
> Regards,
> $iva
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2011-09-06 Thread sukran dhawan
addresses are compared here  i think

On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:

>
> main()
> {
> char *p="persons";
> clrscr();
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
>
> ..op : technical persons ..plz explain .. how come it works like an strcmp
> operation???
> --
> Regards,
> $iva
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output????

2011-09-06 Thread Rajeshwar Patra
pointer points to read only memory location
and this address is then compared whch evaluates to true
hence the output...

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2011-09-06 Thread Dheeraj Sharma
in case of constant strings..they all return the same pointer..where they
are defined..
but in case of non constant strings..like a[]="sumthing" and
b[]="sumthing"...they will have separate memory allocations..

On Tue, Sep 6, 2011 at 9:12 PM, aditi garg wrote:

> It is basically comparing the addresses  of the two and since p contains
> the memory address of "persons" it gives the output as technical persons...
> infact ull be surprised to see dis
>
> #include
> main(){char p[]="persons";char q[]="persons";if(p==q)
> printf 
> ("technical
>  %s",p);elseprintf 
> ("true 
> %s",p);return 0;}
>
> output : true persons
>
>
> #include
> main(){char *p="persons";char *q="persons";if(p==q)
> printf 
> ("technical
>  %s",p);elseprintf 
> ("true 
> %s",p);return 0;
>
> }
> bt Here output will be Technical persons
> On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:
>
>>
>> main()
>> {
>> char *p="persons";
>> clrscr();
>> if(p=="persons")
>> printf("technical %s",p);
>> else
>> printf("true %s",p);
>> return 0;
>> }
>>
>> ..op : technical persons ..plz explain .. how come it works like an strcmp
>> operation???
>> --
>> Regards,
>> $iva
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2011-09-06 Thread aditi garg
It is basically comparing the addresses  of the two and since p contains the
memory address of "persons" it gives the output as technical persons...
infact ull be surprised to see dis

#include
main(){char p[]="persons";char q[]="persons";if(p==q)printf
("technical
%s",p);elseprintf
("true
%s",p);return 0;}

output : true persons


#include
main(){char *p="persons";char *q="persons";if(p==q)printf
("technical
%s",p);elseprintf
("true
%s",p);return 0;

}
bt Here output will be Technical persons
On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:

>
> main()
> {
> char *p="persons";
> clrscr();
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
>
> ..op : technical persons ..plz explain .. how come it works like an strcmp
> operation???
> --
> Regards,
> $iva
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output????

2011-09-06 Thread Shravan Kumar
String literals are saved into a separate table in compiler. So second time
when you define "persons" it wont be created or allocated memory as it
already exists in table.

On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:

>
> main()
> {
> char *p="persons";
> clrscr();
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
>
> ..op : technical persons ..plz explain .. how come it works like an strcmp
> operation???
> --
> Regards,
> $iva
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output????

2011-09-06 Thread sivaviknesh s
main()
{
char *p="persons";
clrscr();
if(p=="persons")
printf("technical %s",p);
else
printf("true %s",p);
return 0;
}

..op : technical persons ..plz explain .. how come it works like an strcmp
operation???
-- 
Regards,
$iva

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-09-01 Thread Anil Arya
output is machine dependent.

On 9/1/11, sukran dhawan  wrote:
> sizeof considers everything between double quotes + /0 character
> strlen reads until first \0
>
> On Thu, Sep 1, 2011 at 5:49 PM, sukran dhawan wrote:
>
>> 9 and 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>
>


-- 
*Anil  Arya,
Computer Science *
*Motilal Nehru 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 output

2011-09-01 Thread sukran dhawan
sizeof considers everything between double quotes + /0 character
strlen reads until first \0

On Thu, Sep 1, 2011 at 5:49 PM, sukran dhawan wrote:

> 9 and 3
>
>
> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>
>> output??
>>
>> int main()
>> {
>> char *d = "abc\0def\0";
>> printf("%d %d",sizeof(d),strlen(d));
>> getch();
>> }
>>
>> --
>> 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/-/nf_M_Yoep_EJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2011-09-01 Thread sukran dhawan
9 and 3

On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:

> output??
>
> int main()
> {
> char *d = "abc\0def\0";
> printf("%d %d",sizeof(d),strlen(d));
> getch();
> }
>
> --
> 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/-/nf_M_Yoep_EJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-31 Thread Swathi
Depends on the 32-bit or 64-bit...
sizeof(d) -> returns the 4 in case of 32-bit, 8 incase of 64-bit
strlen(d) -> 3

On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma  wrote:

> 8 3 is correct..winshuttle mein aaya tha ;)
>
>
> On Wed, Aug 31, 2011 at 9:30 PM, aditi garg wrote:
>
>> No sizeof ignores \0
>>
>>
>> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH 
>> wrote:
>>
>>> its 4 3   i think
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg 
>>> wrote:
>>>
 8 3


 On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:

> output??
>
> int main()
> {
> char *d = "abc\0def\0";
> printf("%d %d",sizeof(d),strlen(d));
> getch();
> }
>
> --
> 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/-/nf_M_Yoep_EJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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


  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>>
>
>
>
> --
> *Dheeraj Sharma*
> Comp Engg.
> NIT Kurukshetra
> +91 8950264227
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-31 Thread aditi garg
8 3

On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:

> output??
>
> int main()
> {
> char *d = "abc\0def\0";
> printf("%d %d",sizeof(d),strlen(d));
> getch();
> }
>
> --
> 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/-/nf_M_Yoep_EJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-31 Thread Dheeraj Sharma
for this
char *d = "abc\ldef\l";

the output is 4 8 not 4 9 \l treated as one character


On Wed, Aug 31, 2011 at 9:34 PM, aditi garg wrote:

> @dheeraj yea true,,,bt ut ws an array...its a pointer here...so output will
> be 4  3...
> infact it wud be 9 3 in the case u r considering
>
>
> On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma <
> dheerajsharma1...@gmail.com> wrote:
>
>> 8 3 is correct..winshuttle mein aaya tha ;)
>>
>>
>> On Wed, Aug 31, 2011 at 9:30 PM, aditi garg wrote:
>>
>>> No sizeof ignores \0
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH 
>>> wrote:
>>>
 its 4 3   i think


 On Wed, Aug 31, 2011 at 9:25 PM, aditi garg 
 wrote:

> 8 3
>
>
> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>
>> output??
>>
>> int main()
>> {
>> char *d = "abc\0def\0";
>> printf("%d %d",sizeof(d),strlen(d));
>> getch();
>> }
>>
>> --
>> 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/-/nf_M_Yoep_EJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

>>>
>>>
>>>
>>> --
>>> Aditi Garg
>>> Undergraduate Student
>>> Electronics & Communication Divison
>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>> Sector 3, Dwarka
>>> New 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.
>>>
>>
>>
>>
>> --
>> *Dheeraj Sharma*
>> Comp Engg.
>> NIT Kurukshetra
>> +91 8950264227
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-31 Thread SANDEEP CHUGH
+1 aditi

On Wed, Aug 31, 2011 at 9:34 PM, aditi garg wrote:

> @dheeraj yea true,,,bt ut ws an array...its a pointer here...so output will
> be 4  3...
> infact it wud be 9 3 in the case u r considering
>
>
> On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma <
> dheerajsharma1...@gmail.com> wrote:
>
>> 8 3 is correct..winshuttle mein aaya tha ;)
>>
>>
>> On Wed, Aug 31, 2011 at 9:30 PM, aditi garg wrote:
>>
>>> No sizeof ignores \0
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH 
>>> wrote:
>>>
 its 4 3   i think


 On Wed, Aug 31, 2011 at 9:25 PM, aditi garg 
 wrote:

> 8 3
>
>
> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>
>> output??
>>
>> int main()
>> {
>> char *d = "abc\0def\0";
>> printf("%d %d",sizeof(d),strlen(d));
>> getch();
>> }
>>
>> --
>> 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/-/nf_M_Yoep_EJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

>>>
>>>
>>>
>>> --
>>> Aditi Garg
>>> Undergraduate Student
>>> Electronics & Communication Divison
>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>> Sector 3, Dwarka
>>> New 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.
>>>
>>
>>
>>
>> --
>> *Dheeraj Sharma*
>> Comp Engg.
>> NIT Kurukshetra
>> +91 8950264227
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-31 Thread SANDEEP CHUGH
8 3 wud the answer if you use the following syntax

int main()
{
char d[] = "abc\0def\0";
printf("%d %d",sizeof(d),strlen(d));
getch();
}


as you are using char *d

so sizeof will print only size of pointer variable


On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma  wrote:

> 8 3 is correct..winshuttle mein aaya tha ;)
>
>
> On Wed, Aug 31, 2011 at 9:30 PM, aditi garg wrote:
>
>> No sizeof ignores \0
>>
>>
>> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH 
>> wrote:
>>
>>> its 4 3   i think
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg 
>>> wrote:
>>>
 8 3


 On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:

> output??
>
> int main()
> {
> char *d = "abc\0def\0";
> printf("%d %d",sizeof(d),strlen(d));
> getch();
> }
>
> --
> 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/-/nf_M_Yoep_EJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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


  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>>
>
>
>
> --
> *Dheeraj Sharma*
> Comp Engg.
> NIT Kurukshetra
> +91 8950264227
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-31 Thread aditi garg
@dheeraj yea true,,,bt ut ws an array...its a pointer here...so output will
be 4  3...
infact it wud be 9 3 in the case u r considering

On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma  wrote:

> 8 3 is correct..winshuttle mein aaya tha ;)
>
>
> On Wed, Aug 31, 2011 at 9:30 PM, aditi garg wrote:
>
>> No sizeof ignores \0
>>
>>
>> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH 
>> wrote:
>>
>>> its 4 3   i think
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg 
>>> wrote:
>>>
 8 3


 On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:

> output??
>
> int main()
> {
> char *d = "abc\0def\0";
> printf("%d %d",sizeof(d),strlen(d));
> getch();
> }
>
> --
> 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/-/nf_M_Yoep_EJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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


  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>>
>
>
>
> --
> *Dheeraj Sharma*
> Comp Engg.
> NIT Kurukshetra
> +91 8950264227
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-31 Thread annarao kataru
yes it must be 4 3

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-31 Thread Dheeraj Sharma
8 3 is correct..winshuttle mein aaya tha ;)

On Wed, Aug 31, 2011 at 9:30 PM, aditi garg wrote:

> No sizeof ignores \0
>
>
> On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH wrote:
>
>> its 4 3   i think
>>
>>
>> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>>
>>> 8 3
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>>
 output??

 int main()
 {
 char *d = "abc\0def\0";
 printf("%d %d",sizeof(d),strlen(d));
 getch();
 }

 --
 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/-/nf_M_Yoep_EJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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.
>



-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-31 Thread aditi garg
sorry my mistake...
it wud be 4 3

On Wed, Aug 31, 2011 at 9:30 PM, sachin goyal  wrote:

> 2 3 because d is pointer avriable
>
> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>
>> 8 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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 output

2011-08-31 Thread rahul vatsa
sizeof(d) is the sz of pointer, so depending on arch it will be 4 or 8 ...


On Wed, Aug 31, 2011 at 11:57 AM, SANDEEP CHUGH wrote:

> its 4 3   i think
>
>
> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>
>> 8 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2011-08-31 Thread SANDEEP CHUGH
i said 4 3 according to 32 bit machine.. if its 16 bit thn it wud be 2 3

On Wed, Aug 31, 2011 at 9:30 PM, sachin goyal  wrote:

> 2 3 because d is pointer avriable
>
> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>
>> 8 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2011-08-31 Thread Sanjay Rajpal
o/p will be 4 3.


Sanju
:)



On Wed, Aug 31, 2011 at 8:57 AM, SANDEEP CHUGH wrote:

> its 4 3   i think
>
>
> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>
>> 8 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>>  To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2011-08-31 Thread aditi garg
No sizeof ignores \0

On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH wrote:

> its 4 3   i think
>
>
> On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:
>
>> 8 3
>>
>>
>> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>>
>>> output??
>>>
>>> int main()
>>> {
>>> char *d = "abc\0def\0";
>>> printf("%d %d",sizeof(d),strlen(d));
>>> getch();
>>> }
>>>
>>> --
>>> 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/-/nf_M_Yoep_EJ.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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 output

2011-08-31 Thread rohit
output??

int main()
{
char *d = "abc\0def\0";
printf("%d %d",sizeof(d),strlen(d));
getch();
}

-- 
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/-/nf_M_Yoep_EJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-31 Thread sachin goyal
2 3 because d is pointer avriable

On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:

> 8 3
>
>
> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>
>> output??
>>
>> int main()
>> {
>> char *d = "abc\0def\0";
>> printf("%d %d",sizeof(d),strlen(d));
>> getch();
>> }
>>
>> --
>> 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/-/nf_M_Yoep_EJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-31 Thread SANDEEP CHUGH
its 4 3   i think


On Wed, Aug 31, 2011 at 9:25 PM, aditi garg wrote:

> 8 3
>
>
> On Wed, Aug 31, 2011 at 9:22 PM, rohit  wrote:
>
>> output??
>>
>> int main()
>> {
>> char *d = "abc\0def\0";
>> printf("%d %d",sizeof(d),strlen(d));
>> getch();
>> }
>>
>> --
>> 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/-/nf_M_Yoep_EJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-22 Thread sukran dhawan
its 10
On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:

> #include
>
> #define max(a,b) (a>b?a:b)
>
>
> int main()
> {
>
>  int j=max(3+2,2+8);
>  printf("%d",j);
>
>return 0;
> }
>
>why this program show output as 9 ? please help me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-22 Thread code pool
10 as 3+2>2+8?3+2:2+8  5>10?5:10   ' + ' has more precedence then ?: as well
as > s o/p is 10..

correct me if i am wrong.

On Tue, Aug 23, 2011 at 12:50 AM, gmagog...@gmail.com
wrote:

> output is 10 using gcc 4.5.2
>
> Yanan Cao
>
>
>
> On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek wrote:
>
>> Yeah its o/p is 10 :)
>>
>>
>> On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote:
>>
>>> its output is
>>>
>>> 10
>>>
>>>
>>> On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:
>>>
 #include

 #define max(a,b) (a>b?a:b)


 int main()
 {

  int j=max(3+2,2+8);
  printf("%d",j);

return 0;
 }

why this program show output as 9 ? please help me

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


>>>
>>>
>>> --
>>> U.D.I.T
>>>
>>> Sent by Nokia OVI (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.
>>>
>>
>>
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-22 Thread gmagog...@gmail.com
output is 10 using gcc 4.5.2

Yanan Cao



On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek  wrote:

> Yeah its o/p is 10 :)
>
>
> On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote:
>
>> its output is
>>
>> 10
>>
>>
>> On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:
>>
>>> #include
>>>
>>> #define max(a,b) (a>b?a:b)
>>>
>>>
>>> int main()
>>> {
>>>
>>>  int j=max(3+2,2+8);
>>>  printf("%d",j);
>>>
>>>return 0;
>>> }
>>>
>>>why this program show output as 9 ? please help me
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> U.D.I.T
>>
>> Sent by Nokia OVI (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.
>>
>
>
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-22 Thread sagar pareek
Yeah its o/p is 10 :)

On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote:

> its output is
>
> 10
>
>
> On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:
>
>> #include
>>
>> #define max(a,b) (a>b?a:b)
>>
>>
>> int main()
>> {
>>
>>  int j=max(3+2,2+8);
>>  printf("%d",j);
>>
>>return 0;
>> }
>>
>>why this program show output as 9 ? please help me
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> U.D.I.T
>
> Sent by Nokia OVI (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.
>



-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT 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 output

2011-08-22 Thread Deepak Garg
its output is

10

On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:

> #include
>
> #define max(a,b) (a>b?a:b)
>
>
> int main()
> {
>
>  int j=max(3+2,2+8);
>  printf("%d",j);
>
>return 0;
> }
>
>why this program show output as 9 ? please help me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
U.D.I.T

Sent by Nokia OVI (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 output

2011-08-22 Thread rohit
#include

#define max(a,b) (a>b?a:b)


int main()
{

 int j=max(3+2,2+8);
 printf("%d",j);

return 0;
}

why this program show output as 9 ? please help me

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-16 Thread himanshu kansal
i think this must have produced a warning..conversion from const char *
to char*...

On Tue, Aug 16, 2011 at 8:52 PM, Sanjay Rajpal wrote:

> This is becuase "Hello" is a constant string and constant strings get
> stored in *Data Area, not in stack for the function you called. *Thats why
> pointer to constant string will be returned and program will not produce any
> error.
>
>
> Sanjay Kumar
> B.Tech Final Year
> Department of Computer Engineering
> National Institute of Technology Kurukshetra
> Kurukshetra - 136119
> Haryana, India
>
>
>
> On Tue, Aug 16, 2011 at 8:19 AM, rohit  wrote:
>
>> #includeconst char *fun();
>> int main()
>> {
>> char *ptr = fun();
>> return 0;
>> }const char *fun()
>> {
>> return "Hello";
>> }
>>
>>
>> Why doesn't this code give 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/-/qeUTNwGNKfwJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 output

2011-08-16 Thread Sanjay Rajpal
This is becuase "Hello" is a constant string and constant strings get stored
in *Data Area, not in stack for the function you called. *Thats why pointer
to constant string will be returned and program will not produce any error.


Sanjay Kumar
B.Tech Final Year
Department of Computer Engineering
National Institute of Technology Kurukshetra
Kurukshetra - 136119
Haryana, India



On Tue, Aug 16, 2011 at 8:19 AM, rohit  wrote:

> #includeconst char *fun();
> int main()
> {
> char *ptr = fun();
> return 0;
> }const char *fun()
> {
> return "Hello";
> }
>
>
> Why doesn't this code give 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/-/qeUTNwGNKfwJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 output

2011-08-16 Thread rohit


#includeconst char *fun();
int main()
{
char *ptr = fun();
return 0;
}const char *fun()
{
return "Hello";
}


Why doesn't this code give 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/-/qeUTNwGNKfwJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 Output

2011-08-14 Thread rahul aravind
I think the address of string 5 located will be added with 1 and 2...

On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay <
brijeshupadhyay...@gmail.com> wrote:

> int main ()
> {
>   printf("%d",1+2+"5");
>   getch();
>   return 0;
> }
>
>
> what should it return and how..??
>
> --
> 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/-/2H3Gg6hLEQ0J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 Output

2011-08-13 Thread Ankur Khurana
"5" will represent address of "5" in heap. so adding 3 to "5" increment tht
address by 3 and print it on the screen

On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay <
brijeshupadhyay...@gmail.com> wrote:

> int main ()
> {
>   printf("%d",1+2+"5");
>   getch();
>   return 0;
> }
>
>
> what should it return and how..??
>
> --
> 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/-/2H3Gg6hLEQ0J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
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 Output

2011-08-13 Thread sukran dhawan
i got a warning in gcc and the output was garbage

On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay <
brijeshupadhyay...@gmail.com> wrote:

> int main ()
> {
>   printf("%d",1+2+"5");
>   getch();
>   return 0;
> }
>
>
> what should it return and how..??
>
> --
> 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/-/2H3Gg6hLEQ0J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 Output

2011-08-13 Thread Brijesh Upadhyay
int main ()
{
  printf("%d",1+2+"5");
  getch();
  return 0;
} 


what should it return and how..??

-- 
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/-/2H3Gg6hLEQ0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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   3   >