Results 1 to 5 of 5

Thread: Implement the isgraph() : C

  1. #1
    Join Date
    Dec 2009
    Posts
    28

    Implement the isgraph() : C

    Hello, I am the student of the Bsc-IT. I had learned the C language in first year of Bsc-IT. I can know about the functions in C language. I have to submit the assignment on the isgraph() function. So, I would like to know about the isgraph() function. I would also like to know how can I Implement the isgraph() function in C language. If there is anyone who can have the solution on the isgraph() functions then reply me!!!
    Last edited by Gaauge; 09-02-2010 at 03:33 PM.

  2. #2
    Join Date
    Nov 2005
    Posts
    1,323

    Implement the isgraph() : C

    Hi, The isgraph() function can checks except space for any printable character. The isgraph() function can be the member of the <ctype.h> header file. The isgraph() function can returns the zero if the argument of the isgraph() function can not be a printable character code. And returns the space or zero if the argument of the isgraph() function can be a printable character code. The following can be the syntax of the isgraph() function in the C language :
    Code:
    #include <ctype.h>
    int isgraph( int d );
    Last edited by absolute55; 09-02-2010 at 03:49 PM.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,394

    Program : Implement the isgraph()

    Program :
    Code:
    #include <ctype.h>
    #include <stdio.h>
      int main(void)
     {
        char C;
        for(;;) {
          C = getchar();
          if(isgraph(C)){
             printf("%c is printable\n", C);
          }
          if(C == '.'){
             break;
          }
        }
        return 0;
      }
    Output :
    Code:
    1
    1 is printable
    2
    2 is printable
    3
    3 is printable
    4
    4 is printable
    .
    . is printable

  4. #4
    Join Date
    May 2008
    Posts
    2,393

    The isgraph() : C

    The following example of the isgraph() function can demonstrates you the working of the isgraph() function :
    Code:
    #include <stdio.h>
    #include <ctype.h>
    char ch[] = {'C', 0x09, ' ', 0x7d};
    #define SIZE sizeof( ch ) / sizeof( char )
    void main()
      {
        int k;
        for( k = 0; k < SIZE; k++ ) {
          printf( "Char %c is %sa printable character\n",
            ch[k],
            ( isgraph( ch[k] ) ) ? "" : "not " );
        }
      }
    Output :
    Code:
    Char C is a printable character
    Char     is not a printable character
    Char   is not a printable character
    Char } is a printable character

  5. #5
    Join Date
    Feb 2008
    Posts
    1,856

    The isgraph()

    Except than the ' ' space the isgraph() function can checks for any character that can be printable. Whenever the argument can not be a printable character then the isgraph() function can returns the zero. And When the argument can be a printable character then the isgraph() function can returns the non zero.
    I hope you can understand about the isgraph() function from the above description.

Similar Threads

  1. How to implement sum() faster in c#?
    By Luis-Fernando in forum Software Development
    Replies: 4
    Last Post: 27-02-2010, 08:25 PM
  2. How can I implement the remove() in CPP
    By Servant in forum Software Development
    Replies: 5
    Last Post: 22-02-2010, 03:18 PM
  3. Implement the copy_backward() in C++
    By Agustíne in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 08:46 PM
  4. Implement the equal_range() in C++
    By Garrick in forum Software Development
    Replies: 5
    Last Post: 15-02-2010, 06:09 PM
  5. How to implement IP Sec
    By Enriquee in forum Technology & Internet
    Replies: 5
    Last Post: 12-01-2010, 05:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •