Blog Moved

This website completely moved to new domain. For latest content, visit www.programmingposts.com

Search This Blog

14 Apr 2013

C PROGRAM TO PRINT SOURCE PROGRAM NAME

#include<stdio.h>
main(int argc, char *argv[])
{
	char *p=argv[0];
	printf("\n *** C PROGRAMS BLOG ***");
	printf("\n >>> C PROGRAM TO PRINT NAME OF SOURCE PROGRAM <<< \n");
	printf("\n Program name is :  %s ",p);
	getch();
}

6 comments:

  1. This was a nice post. This sort of post will encourage students to learn C

    Thanx
    from
    www.bunksallowed.blogspot.in

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. *** C program to display its own source code ***

    #include
    int main()
    {
    FILE *p;
    char c;
    p = fopen(__FILE__,"r");
    do
    {
    c = getc(p);
    putchar(c);
    }
    while(c != EOF);
    fclose(p);
    return 0;
    }

    Source : http://goo.gl/HZxV6y

    ReplyDelete
  4. Good
    Here is a link for C/C++ programs and pointer programs. This may be useful for you.

    C/C++ Programs

    ReplyDelete
  5. thank you for sharing useful article
    web programming tutorial
    welookups

    ReplyDelete