Archive for March, 2004

What is the output of these simple C programs?

Posted on March 25, 2004. Filed under: C/C++ |

Do you know what is the output of these simple C programs?

Check your thought with real compiler.

#include<stdio.h>
int main(int argc, char **argv)
{
    char *ptr = “ABCD”;
    printf( “%cn”,*(ptr++) );
    return 0;
}

 

int main(int argc, char **argv)
{
    char *ptr = “ABCD”;
    printf( “%cn”,*(ptr++) );
    printf(“%sn”, ptr);

    return 0;
}

 

int main(int argc, char **argv)
{
    char *ptr = “ABCD”;
    printf( “%cn”,*ptr++ );
    printf(“%sn”, ptr);

    return 0;
}

Advertisements
Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...