need help to fix warning: "[Warning] unknown escape sequence '\>' "

This is a discussion on need help to fix warning: "[Warning] unknown escape sequence '\>' " within the C Programming forums, part of the General Programming Boards category; Hi, I am able to compile successfully. But I found just minor problem where compiler said "[Warning] unknown escape sequence ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    16

    g

    Hi, I am able to compile successfully. But I found just minor problem where compiler said "[Warning] unknown escape sequence '\>' "
    Could you please fix as soon as possible. Need to submit assign today

    Code:
    #include<stdio.h>
    
    #include<string.h>
    
    #include<stdlib.h>
    
    #define STR_SIZE 100
    
    
    
    struct node
    
    {
    
    char data;
    
    struct node *next;
    
    };
    
    
    
    void start(void);
    
    void getString(void);
    
    void makeLinkList(struct node *head);
    
    void printInPutStr(struct node *head);
    
    int getNumber(void);
    
    void replaceNode(int inPut, struct node *head);
    
    void printOutPutStr(struct node *head);
    
    void printStr(struct node *head);
    
    void end(void);
    
    void emptyLinkedList(struct node *head);
    
    char inPutStr[STR_SIZE];
    
    int number;
    
    int main(void)
    
    {
    
    char inPutChar; // USED AS PART OF PROGRAM TERMINATION
    
    int inPut; // HOLDS VALUE OF INDEX ENTERED BY THE USER
    
    struct node *head = NULL; // SAME
    
    int count; // INDEX VALUE
    
    printf("\n Data Flow Structures & Linked Lists");
    
    printf("\n -----------------------------------------------------------------\n\n");
    
    printf(" USER INSTRUCTIONS \n");
    
    printf(" > Write a program that creates a linked list of characters from a string \n");
    
    printf(" > entered by the user.\n");
    
    printf(" > The program is then to accept a second string and an index from the user. \n");
    
    printf(" > The second string is then to be inserted into the first string at the \n");
    
    printf(" > location given by the index. \n\n");
    
    start();
    
    getString();
    
    
    
    head = (struct node*) calloc(1, sizeof (struct node));
    
    
    
    makeLinkList(head);
    
    printInPutStr(head);
    
    inPut = getNumber();
    
    replaceNode(inPut, head);
    
    printOutPutStr(head);
    
    end();
    
    }
    
    void start(void)
    
    {
    
    printf(" STARTING PROGRAM...\n");
    
    }
    
    void getString(void)
    
    {
    
    printf(" Please enter a string (Maximum length %d characters) \n\t C:\> ", STR_SIZE);
    
    gets(inPutStr);
    
    fflush(stdin);
    
    while(inPutStr[0] == 0 || inPutStr[0] == ' ')
    
    {
    
    printf("\n\t NOTHING INSERTED! RE-ENTER A STRING \n\t C:\> ");
    
    gets(inPutStr);
    
    fflush(stdin);
    
    }
    
    }
    
    void makeLinkList(struct node *head)
    
    {
    
    struct node *current, *previous;
    
    int i;
    
    current = head;
    
    current->next = (struct node*)calloc(1, sizeof(struct node));
    
    current=current->next;
    
    for ( i = 0 ; inPutStr[i] != 0 ; ++i )
    
    {
    
    current->data= inPutStr[i];
    
    current->next = (struct node*)calloc(1, sizeof(struct node));
    
    previous = current;
    
    current = current->next;
    
    }
    
    free(current);
    
    previous->next = NULL;
    
    current = head;
    
    }
    
    void printInPutStr(struct node *head)
    
    {
    
    printf("\n USER INPUT:\n > ");
    
    emptyLinkedList(head);
    
    printStr(head);
    
    }
    
    
    
    int getNumber(void)
    
    {
    
    int inP1, inP2;
    
    printf("\n\n Enter Index value \n\t C:\> ", STR_SIZE);
    
    scanf("%d",&inP1);
    
    fflush(stdin);
    
    while(inP1<1)
    
    {
    
    printf("\n\t INVALID ENTRY! RE-ENTER DIGIT \n\t C:\> ");
    
    scanf("%d",&inP1);
    
    fflush(stdin);
    
    }
    
    
    
    return (inP1);
    
    }
    
    
    
    void replaceNode(int inPut, struct node *head)
    
    {
    
    struct node *current, *previous, *forward;
    
    int i=0,j=0;
    
    int l,c;
    
    l=inPut;
    
    current = head;
    
    for( ; j<l; j++)
    
    {
    
    current=current->next;
    
    }
    
    
    
    while (current!=NULL)
    
    {
    
    inPutStr[i]=current->data;
    
    current=current->next;
    
    i++;
    
    }
    
    current = head;
    
    j=0;
    
    while(j<=l+1)
    
    {
    
    inPutStr[i]=current->data;
    
    current=current->next;
    
    i++;
    
    j++;
    
    }
    
    
    
    current = head;
    
    i=0;
    
    
    
    while(current!=NULL)
    
    {
    
    current->data = inPutStr[i];
    
    i++;
    
    current = current->next;
    
    }
    
    }
    
    void printOutPutStr(struct node *head)
    
    {
    
    printf("\n MODIFIED STRING:\n > ");
    
    emptyLinkedList(head);
    
    printStr(head);
    
    }
    
    
    
    void printStr(struct node *head)
    
    {
    
    struct node *current;
    
    current = head;
    
    do
    
    {
    
    current = current->next;
    
    printf("%c", current->data);
    
    
    
    }
    
    while(current->next != NULL);
    
    }
    
    void end(void)
    
    {
    
    char inPutChar;
    
    printf(" PRESS ANY KEY TO EXIT PROGRAM...\n");
    
    scanf("%c",&inPutChar);
    
    fflush(stdin);
    
    }
    
    
    
    void emptyLinkedList(struct node *head)
    
    {
    
    if(head->next == NULL)
    
    {
    
    printf("\Empty Linked List!!!!");
    
    }
    
    }
    Last edited by Salem; 05-28-2010 at 09:46 AM. Reason: Restoration - please don't go round deleting your posts just as soon as you think you've got an answer

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    fflush(stdin) is wrong. Your compiler should tell you line number.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    16
    Could you please check this from Dev C++ compiler as it just said 5 warnings with no line number.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    Your application isn't that large. There can't be that many places in the application with the string "\>". If you read about escape sequences then you should be able to see how to properly represent this sequence of characters.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    16
    Is it possible you help me now? I will find out escape sequences later but don't have time to check now because i am about to submit assign within minutes.

  7. #7
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    I've pointed you towards the answer. Escape sequences are by no means the most complicated facet of C, it would only take several minutes to read.

    Most people here don't give out answers to homework, just because yours is due in several minutes it doesn't make you an exception.

    If someone else wants to give you the answer, that's their choice but I sure as hell ain't.

  8. #8
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,803
    Once again we have someone who edits their posts to nothing after people have responded. Salem, can I request smiting from you like you did with gulfx01 back in Apr 14th?
    Last edited by hk_mp5kpdw; 05-28-2010 at 05:21 AM.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    Quote Originally Posted by myself
    please don't go round deleting your posts just as soon as you think you've got an answer
    a) you might not actually have the answer, and if you haven't, there is no way for later arrivals to correct earlier answers.
    b) the whole point of the board is to share and learn from each other. Deleting your posts makes this IMPOSSIBLE (this is highly anti-social).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    MTK
    MTK is offline
    Registered User
    Join Date
    Aug 2009
    Posts
    198
    Code:
    printf("\n\n Enter Index value \n\t C:\> ", STR_SIZE);
    It should be C:\\>.

    \n - newline

    \t - tab

    \\ - backslash

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-24-2009, 01:41 AM
  2. Need help starting a program with functions
    By Neotriz in forum C Programming
    Replies: 7
    Last Post: 11-01-2009, 04:45 PM
  3. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  4. Need to fix Linux 'connect' warning.
    By bchaffin72 in forum Networking/Device Communication
    Replies: 2
    Last Post: 04-04-2009, 01:58 PM
  5. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 03:33 PM

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