about Pointer | | |
#include <stdio.h>
int main()
{
printf("%s",*("abc" + 1));
return 0;
}
i expected this would show 'bc'
but, Compile error message : format argument is not a pointer (arg 2)
as far as i know, "abc" + 1 is pointer , right ?
Could anyone explain about this ?
TIA ^^ | | | | re: about Pointer
herrcho wrote:
[color=blue]
> #include <stdio.h>
>
> int main() { printf("%s",*("abc" + 1)); return 0; }
>
> i expected this would show 'bc' but, Compile error message :
> format argument is not a pointer (arg 2)
>
> as far as i know, "abc" + 1 is pointer , right ?[/color]
Herrcho...
Right; but *("abc" + 1) is not a pointer.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c | | | | re: about Pointer
herrcho <herrcho2803@kornet.net> wrote in message
news:bkb7os$mn9$1@news1.kornet.net...[color=blue]
> #include <stdio.h>
>
> int main()
> {
> printf("%s",*("abc" + 1));
> return 0;
> }
>
> i expected this would show 'bc'
>
> but, Compile error message : format argument is not a pointer (arg 2)
>
> as far as i know, "abc" + 1 is pointer , right ?[/color]
Yes. But *("abc" + 1) , which is the expression you
supplied for the argument, is not. Its type is 'char'.
printf("%s", "abc" + 1);
[color=blue]
>
> Could anyone explain about this ?[/color]
Um, you didn't look at your code carefully enough? :-)
-Mike | | | | re: about Pointer
On Thu, 18 Sep 2003, herrcho wrote:
[color=blue]
> #include <stdio.h>
>
> int main()
> {
> printf("%s",*("abc" + 1));
> return 0;
> }
>
> i expected this would show 'bc'
> but, Compile error message : format argument is not a pointer (arg 2)
> as far as i know, "abc" + 1 is pointer , right ?
> Could anyone explain about this ?[/color]
("abc"+1) is a pointer. *("abc"+1) is a char. Try:
printf("%s", ("abc"+1));
--
main(){int j=1234;char t[]=":@abcdefghijklmnopqrstuvwxyz.\n",*i=
"iqgbgxmdbjlgdv.lksrqek.n";char *strchr(const char *,int);while(
*i){j+=strchr(t,*i++)-t;j%=sizeof t-1;putchar(t[j]);} return 0;} | | | | re: about Pointer
On Thu, 18 Sep 2003, herrcho wrote:
[color=blue]
>
>
> #include <stdio.h>
>
> int main()
> {
> printf("%s",*("abc" + 1));
> return 0;
> }
>
> i expected this would show 'bc'
>
> but, Compile error message : format argument is not a pointer (arg 2)
>
> as far as i know, "abc" + 1 is pointer , right ?
>[/color]
[color=blue]
> Could anyone explain about this ?[/color]
Yes, but I won't. Other, more benevolent persons, have already taken the
time to point out your short comings.
If hindsight is 20-20, then you must have perfect vision, becuase your an
ass.
clord | | | | re: about Pointer
"clord@clc.net" <clord@thelamp.bc.hsia.telus.net> wrote in message
news:Pine.LNX.4.44.0309181355080.30739-100000@thelamp.bc.hsia.telus.net...[color=blue]
> On Thu, 18 Sep 2003, herrcho wrote:
>[color=green]
> >
> >
> > #include <stdio.h>
> >
> > int main()
> > {
> > printf("%s",*("abc" + 1));
> > return 0;
> > }
> >
> > i expected this would show 'bc'
> >
> > but, Compile error message : format argument is not a pointer (arg 2)
> >
> > as far as i know, "abc" + 1 is pointer , right ?
> >[/color]
>
>
>[color=green]
> > Could anyone explain about this ?[/color]
>
> Yes, but I won't. Other, more benevolent persons, have already taken the
> time to point out your short comings.[/color]
A few rational people have answered the question.
Yours is the only reply I see that contains an insulting
tone (and contained no useful info btw).
[color=blue]
>
> If hindsight is 20-20, then you must have perfect vision, becuase your an
> ass.[/color]
An obvious novice with C asked a valid topical question,
responses to which would be educational to any
other 'newbies' reading.
How does this make Herrcho an 'ass'?
You, however, look like an inconsiderate jerk who cannot
even spell simple English words.
*PLONK*
-Mike | | | | re: about Pointer
Woo hoo! Top posting is fun!
On Thu, 18 Sep 2003, Mike Wahler wrote:
[color=blue]
> "clord@clc.net" <clord@thelamp.bc.hsia.telus.net> wrote in message
> news:Pine.LNX.4.44.0309181355080.30739-100000@thelamp.bc.hsia.telus.net...[color=green]
> > On Thu, 18 Sep 2003, herrcho wrote:
> >[color=darkred]
> > >
> > >
> > > #include <stdio.h>
> > >
> > > int main()
> > > {
> > > printf("%s",*("abc" + 1));
> > > return 0;
> > > }
> > >
> > > i expected this would show 'bc'
> > >
> > > but, Compile error message : format argument is not a pointer (arg 2)
> > >
> > > as far as i know, "abc" + 1 is pointer , right ?
> > >[/color]
> >
> >
> >[color=darkred]
> > > Could anyone explain about this ?[/color]
> >
> > Yes, but I won't. Other, more benevolent persons, have already taken the
> > time to point out your short comings.[/color]
>
> A few rational people have answered the question.[/color]
Rational? I think you are making assumptions, or what we might refer to
as "hasty generalizations".
[color=blue]
> Yours is the only reply I see that contains an insulting
> tone (and contained no useful info btw).[/color]
Again, you are wrong. My tone is one of mirth, not insult. To be
absolutely clear, I was joking! I was trying to highlight how much of a
jerk everybody else in this newgroup is.
[color=blue][color=green]
> >
> > If hindsight is 20-20, then you must have perfect vision, becuase your an
> > ass.[/color]
>[/color]
Now that was funny!
[color=blue]
> An obvious novice with C asked a valid topical question,
> responses to which would be educational to any
> other 'newbies' reading.[/color]
You must have learned something then.
[color=blue]
> How does this make Herrcho an 'ass'?[/color]
He's not --you are!
[color=blue]
> You, however, look like an inconsiderate jerk who cannot
> even spell simple English words.
>[/color]
The only accurate thing you've said so far. I am a jerk. I am
inconsiderate, and unlike you I don't use spell checkers.
[color=blue]
> *PLONK*
>[/color]
Fuck you.
[color=blue]
> -Mike
>
>[/color]
And you too.
clord | | | | re: about Pointer
Trolling square clod was jivin' on Thu, 18 Sep 2003 23:26:06 GMT in
comp.lang.c.
Re: about Pointer's a bad trip! Dig it!
[color=blue]
>On Thu, 18 Sep 2003, Mike Wahler wrote:
>[color=green]
>> "clord@clc.net" <clord@thelamp.bc.hsia.telus.net> wrote in message
>> news:Pine.LNX.4.44.0309181355080.30739-100000@thelamp.bc.hsia.telus.net...[color=darkred]
>> > On Thu, 18 Sep 2003, herrcho wrote:
>> >
>> > > Could anyone explain about this ?
>> >
>> > Yes, but I won't. Other, more benevolent persons, have already taken the
>> > time to point out your short comings.[/color]
>>
>> A few rational people have answered the question.[/color]
>
>Rational? I think you are making assumptions, or what we might refer to
>as "hasty generalizations".
>[color=green]
>> Yours is the only reply I see that contains an insulting
>> tone (and contained no useful info btw).[/color]
>
>Again, you are wrong. My tone is one of mirth, not insult. To be[/color]
No, your tone is one of obnoxious insult.
[color=blue]
>absolutely clear, I was joking! I was trying to highlight how much of a[/color]
If you were joking, then I (for one) fail to get it. You blatantly
called the OP an ass. AFAICS, the only assinine person here is you,
Clod.
[color=blue]
>jerk everybody else in this newgroup is.[/color]
You highlighted yourself, Clod, only yourself. You called attention
to your own idiocy. But, like idiots everywhere, you seem unable to
see yourself for what you really are.
[color=blue][color=green][color=darkred]
>> > If hindsight is 20-20, then you must have perfect vision, becuase your an
>> > ass.[/color][/color]
>
>Now that was funny![/color]
No, Clod, that was insulting. If you thought that was funny, then
you must be seriously disturbed. You need urgent psychiatric help.
[color=blue][color=green]
>> An obvious novice with C asked a valid topical question,
>> responses to which would be educational to any
>> other 'newbies' reading.[/color]
>
>You must have learned something then.[/color]
I bet he learned that you are an idiot and a troll, and that you are
not worth wasting any more effort listening to.
[color=blue][color=green]
>> How does this make Herrcho an 'ass'?[/color]
>
>He's not --you are![/color]
Then why did you call him an ass, Clod?
[color=blue][color=green]
>> You, however, look like an inconsiderate jerk who cannot
>> even spell simple English words.[/color]
>
>The only accurate thing you've said so far. I am a jerk. I am[/color]
Everything Mike has said so far is accurate.
[color=blue]
>inconsiderate, and unlike you I don't use spell checkers.[/color]
You would be wise to start using one, then, Clod. I don't think Mike
uses one, though. I don't think he needs one. (I could be wrong,
though.)
[color=blue][color=green]
>> *PLONK*[/color]
>
>Fuck you.[/color]
And since he has plonked you, your foul-mouthed insult will fall on
deaf ears, so to speak. But everone else in this newsgroup will see
what an obnoxious dick you really are.
Go away, Clod, you troll, until you learn to conduct yourself with
proper decorum.
[color=blue][color=green]
>> -Mike[/color]
>
>And you too.[/color]
And him too what? |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|