Urgent Help needed!

This is a discussion on Urgent Help needed! within the C++ Programming forums, part of the General Programming Boards category; Code: #include <stdio.h> #define MAXSTRLEN 255 main () { /*main*/ char *CurCharPtr; char String [MAXSTRLEN]; printf("Enter a line of text:"); ...

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    Urgent Help needed!

    Code:
    #include <stdio.h>
    #define MAXSTRLEN    255
    
    main ()
    {     /*main*/
       char       *CurCharPtr;
       char       String [MAXSTRLEN];
    
       printf("Enter a line of text:"); /*write a prompt*/
       fgets(String,MAXSTRLEN,stdin);   /*read the line*/
    
       /*Print a character until found
       *a zero terminator is found
       */
    
       for (CurCharPtr= &string[0]; *CurCharPtr!='\0';
       CurCharPtr++)
    
    
       printf("The next character is %c\n", *CurCharPtr);
    
    }
       /*main*/

    How do i rewrite the above program by simplifying it using array and pointer references?

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    this is C not C++

  3. #3
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    I think you are already using arrays about pointer you are still using what do u want

  4. #4
    Professional Chef leeor_net's Avatar
    Join Date
    Apr 2004
    Location
    Charles Town, WV
    Posts
    147
    Google stringstring, string and cin. Viola, problem solved.
    - Leeor

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Urgent Help Needed In Writing Algorithm!!
    By Vikramnb in forum C++ Programming
    Replies: 1
    Last Post: 01-09-2009, 11:46 AM
  2. boolean algebra....urgent help needed!
    By Saimadhav in forum C++ Programming
    Replies: 1
    Last Post: 07-28-2008, 07:22 AM
  3. Urgent Needed - PERL
    By beely in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-02-2002, 08:09 PM
  4. Help Needed: Borland C++ 5.5 Installation - URGENT!
    By Linette in forum C++ Programming
    Replies: 12
    Last Post: 03-09-2002, 05:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21