Thread: help with some question in C

  1. #1
    Registered User
    Join Date
    May 2020
    Posts
    1

    Post help with some question in C

    need to make function that get string "One two three 456 seven Eight nine" and make it to "nine Eight seven 456 three two One"
    Code:
    void function7(char *arr)
    {
        int i, TempMax, TempMin;
        char ArrayTest[80] = { ' ' };
        
        for (i = 0; arr[i];++i); // calculate the length of arr
        TempMax = i-1;
        for (i; i >= 0; --i)
        {
            if (arr[i] == ' ' || ArrayTest[i])
            {
                TempMin = i;
                for (TempMin;TempMin <= TempMax; ++TempMin)
                {
                    ArrayTest[TempMin] = arr[TempMin];
                }
                TempMax = i;
            }
        }
    }
    its not the end of that code , but this code " ArrayTest[TempMin] = arr[TempMin];" doesnt works

    someone can help me with writing that code?

    i can use only stdio.h folder

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    I suggest writing your own strcpy function. Maybe call it My_strcpy.

    It does not work is a meaningless phrase; stop using it!
    Say how it does not work.
    Fails to compile?
    Does "Y" when I expect it to do "X".

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User catacombs's Avatar
    Join Date
    May 2019
    Location
    /home/
    Posts
    81
    Quote Originally Posted by alex14114 View Post
    i can use only stdio.h folder
    Is this a class assignment?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 08-25-2014, 05:41 PM
  2. Replies: 1
    Last Post: 03-23-2011, 09:00 AM
  3. *szString = things question/memory question
    By Jang in forum C Programming
    Replies: 3
    Last Post: 01-20-2011, 04:59 AM
  4. Newbish Question file reading question....
    By kas2002 in forum C Programming
    Replies: 23
    Last Post: 05-17-2007, 12:06 PM
  5. Self regiserting DLLs question and libraries question.
    By ApocalypticTime in forum Windows Programming
    Replies: 2
    Last Post: 03-22-2003, 02:02 PM

Tags for this Thread