Saturday, August 18, 2018

PRINT THE GIVEN STRING

  • Problem Description

    Print a string using Pointer
  • CODING ARENA::
  • #include <stdio.h>
    int main()
    {
      char ch[20];
      char *ptr;
      scanf("%s",ch);
      ptr=ch;
      while(*ptr!='\0')
         printf("%c",*ptr++);

    return 0;
    }
  • Test Case 1

    Input (stdin)
    Cse
    
    
    Expected Output
    Cse
  • Test Case 2

    Input (stdin)
    eee
    
    
    Expected Output
    eee

No comments:

Post a Comment