Stray error

hi,
I am getting stray error for following simple C programs in Linux . What is this stray error? Can anyone help me? Pleas...
1.
main()
{
int i, n;
char x[10];
strcpy(x,"girl");
n = strlen(x);
x[0]=x[n];
for(i=0; i<n; ++i)
{
printf(%s,x[i]);
}
}
2.
main( )
{
int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf(%u %u %u %d
,a,*a,**a,***a);
printf(%u %u %u %d
,a+1,*a+1,**a+1,***a+1);
}
_ Rajkumar

Comments

  • [blue]You are using ``text rather than "text".
    I also pointed out some minor things in the code below:
    [/blue]
    : hi,
    : I am getting stray error for following simple C programs in Linux . What is this stray error? Can anyone help me? Pleas...
    : 1.
    : main()
    : {
    : int i, n;
    : char x[10];
    : strcpy(x,"girl");
    : n = strlen(x);
    : x[0]=x[n];
    [blue]
    Here you set the contents of the first letter to the contents located
    at [last letter + 1], which is the null termination.
    Doing so effectivly disables the string from all string handling functions, it will be regarded as an empty string.
    [/blue]

    : for(i=0; i<n; ++i)
    : {
    : printf(“%s”,x[i]);
    [blue]
    This line should be
    printf("%c",x[i]);
    [/blue]

    : }
    : }
    : 2.
    : main( )
    : {
    : int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
    : printf(“%u %u %u %d
    ”,a,*a,**a,***a);
    : printf(“%u %u %u %d
    ”,a+1,*a+1,**a+1,***a+1);
    : }
    : _ Rajkumar
    :

  • : : printf(“%u %u %u %d
    ”,a,*a,**a,***a);
    : : printf(“%u %u %u %d
    ”,a+1,*a+1,**a+1,***a+1);
    : : }


    [blue]Anyone have any idea what "“" is? I've seen it before, in some other posts -- is it the browser putting junk in there or what?[/blue]
  • : : : printf(“%u %u %u %d
    ”,a,*a,**a,***a);
    : : : printf(“%u %u %u %d
    ”,a+1,*a+1,**a+1,***a+1);
    : : : }
    :
    :
    : [blue]Anyone have any idea what "“" is? I've seen it before, in some other posts -- is it the browser putting junk in there or what?[/blue]
    :

    Yea I've seen that before too, he must be using an inferior browser =p

    “ left double quotation mark

    ” right double quotation mark


    http://www.w3.org/TR/html401/sgml/entities.html
    http://www.cookwood.com/html/extras/entities.html


    [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

  • [b][red]This message was edited by Lundin at 2005-6-16 5:32:39[/red][/b][hr]
    : : : : printf(“%u %u %u %d
    ”,a,*a,**a,***a);
    : : : : printf(“%u %u %u %d
    ”,a+1,*a+1,**a+1,***a+1);
    : : : : }
    : :
    : :
    : : [blue]Anyone have any idea what "“" is? I've seen it before, in some other posts -- is it the browser putting junk in there or what?[/blue]
    : :
    :
    : Yea I've seen that before too, he must be using an inferior browser =p
    :
    : “ “ left double quotation mark
    :
    : ” ” right double quotation mark
    :
    :
    : http://www.w3.org/TR/html401/sgml/entities.html
    : http://www.cookwood.com/html/extras/entities.html
    :
    :
    : [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]
    :
    :


    Yeah, I'm not using Internet Exploder, I think my browser has got another default encoding.


  • : [b][red]This message was edited by Lundin at 2005-6-16 5:32:39[/red][/b][hr]
    : : : : : printf(“%u %u %u %d
    ”,a,*a,**a,***a);
    : : : : : printf(“%u %u %u %d
    ”,a+1,*a+1,**a+1,***a+1);
    : : : : : }
    : : :
    : : :
    : : : [blue]Anyone have any idea what "“" is? I've seen it before, in some other posts -- is it the browser putting junk in there or what?[/blue]
    : : :
    : :
    : : Yea I've seen that before too, he must be using an inferior browser =p
    : :
    : : “ “ left double quotation mark
    : :
    : : ” ” right double quotation mark
    : :
    : :
    : : http://www.w3.org/TR/html401/sgml/entities.html
    : : http://www.cookwood.com/html/extras/entities.html
    : :
    : :
    : : [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]
    : :
    : :
    :
    :
    : Yeah, I'm not using Internet Exploder, I think my browser has got another default encoding.
    :
    :
    :


    heh.. you changed the left and right quotation marks I posted to numbers in your reply.


    I don't know about you, but I don't even have a left/right double quotation mark key on my keyboard, just one " :)

    Your browser must change the one double quote to what it thinks is a left and a right dbl quote. I'm using Firefox btw.





    [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories