0 like 0 dislike
7.9k views

Write a program that echoes its command-line arguments in reverse order. Running the program by typing

reverse void and null

should produce the following output:

null and void

Example 2:

reverse you are one number

should produce the following output:

number one are you
[Exercise] Coding (C) - asked in C
ID: 22972 - Available when: Unlimited - Due to: Unlimited
2 flags
edited by | 7.9k views
0 0
Called for Help
0 0
Called for Help
0 0
Called for Help

90 Answers

0 like 0 dislike
Hidden content!
int main()
{
    int n, start, end, i;
    char s[100], c;

* ** * * ** ***** *** * ** ** *** ** *** * * &n) != EOF && n != 0) {
* * * ** * ****** * ** ** **** * * * * * *** * ** * *** ** s);

* * * *** * * ** ** *** **** * **** ** ** * = strlen(s) / n;
* * * **** **** *** ** * * ** * * ** * * ***** s[i]; i+=n) {
** ** * ** * ** ** *** ** * ***** * *** * * * *** ** *** * * * * * = i;
** * * * ** * * **** * * ** *** * * * * * * ** * = i + n - 1;
* *** *** **** ** **** ** ** ***** * * ***** * ** ** * ** *** * * < end) {
** * * * * **** **** * ***** ** * * **** ** *** * *** *** ** ** * **** * ** * = s[start];
* * *** ** ** ** ** * ** * *** * ** **** ** ** * * * * * * ****** ** * * * * * * *** ** * = s[end];
* ***** * **** ***** * *** *** * *** * * *** *** *** * ** * ** * ** * * *** **** ** * * * * = c;

* ******** **** *** ** ******* ** ** * * ***** ** * ** ** * * ** ** * ** * * * **** ***
** ** ** ******* ** * **** * * * * * ** ** *** * ******* ** * * *** * * * * * *** * * *
** * ** * *** ** ** *** *** ** * ** ** * * ** * * * ** ** * * ** ** * *
*** * *** * * * ** * * * * ** ** ****

* ** *** * **** * ** * * ** *** ****** ** **** * **** s);
    }

    return 0;
}
answered by (-134 points)
0 0
prog.c: In function 'main':
prog.c:6:11: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
     while(scanf("%d", &n) != EOF && n != 0) {
           ^~~~~
prog.c:6:11: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:6:11: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:6:30: error: 'EOF' undeclared (first use in this function)
     while(scanf("%d", &n) != EOF && n != 0) {
                              ^~~
prog.c:6:30: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
         n = strlen(s) / n;
             ^~~~~~
prog.c:9:13: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:9:13: note: include '<string.h>' or provide a declaration of 'strlen'
prog.c:23:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
         printf("%s\n", s);
         ^~~~~~
prog.c:23:9: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:23:9: note: include '<stdio.h>' or provide a declaration of 'printf'
0 like 0 dislike
Hidden content!
* * * * **
**** * * * *
**** ** * * * ** *



int main(){
* ** * * * * char ** *
* * * char * ***
** * * * int i,j;
* ** * *** ** * ****
* *** ** * int len = ****
*** **   ** ** * *
* * ****   * ** == ' '){
*** *   * *** * ***** * *** * * * **
**** * ** * * * * * * ** * ** * * ** ** ***** * ** *
** * * * }
*** ** * * * *** * *** * *
* *** * *** len = i;
* * * ** * }

}


* **** *** * ** ***** * 0;

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
* * ** * *****
** ** * * ** **



int * *

{

char ***

int *
*
* *
* * * *** *** * *

{
* *** * ')

{
**** ** * **

{
** ** ** * **** * ***

}
* * *** * * * *
* ***

}

}

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
** * * * * **
*** * * * * *****


* * *
** * ** ** * * * *
* i, n, m, N;
** *
** * * * ** * **

{
**** * ')

{
*
* * * ** ** ******* * * **

{
** ** = *
** * ') *** *

}
* *
**

}



}
= n;
** ** ** * *

* ***** * *** ** *
** * * ** * * * *



**** *

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
#include * *** *

#include ** * *** **



int main()

{
* ****** * ** ** * * * *** ** ***
* * * * * * * temp, **** * ***


* ** * *
* * * = * ** ****


** * *** = 8; i < l; i++)
* * *
* ******* * * * == ' ')
* * * * ***
*** * ** ** **
* ** *** ** *
* ** * **


* * **
** *
* * ** = l;
** * *


*** ** ** q ** *** q--)

    {
*** * *** ** *
** * * * = p[q]; j < l-1; j++)
* * ** ***
*** * * ** ** < n)
** **** * *
* * *** * ** * ** * * = * ** ***
* *** * ***** * * **** ** * * * ****
* * ** **** **** *
* * ** *
* * * * * * *
**** ** * *
* **** ******* = (l-1) - i;
* * *** ** ** **
* * * *
* ** * * ***** ** **** ** * ***
** *
*


* * * = 8; i < n; i++)
* ** *
** ** * **** ** ******** ***
* *


** ****** 0;

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>



int main()

{

char a[100];

int i,k,l;

gets(a);

k=strlen(a);
** * * * *** ** **

{
** *** * * * * * ** **** ')
**** ******** ** ****
* ** * * **** * * ** ** * * ** *** **
* * ** * ****** ** * * ** *** ** * *****
* * * * * ******** * * ***** *** * ** * * * *** *** ** * *** * * * ** * ** ** * ***
*** ** ***** * **** *** *** *** **** * *
* ** *** * *** ** * ** **** * **** ** ** ** * * ");
* * ** * * * **** * ** * ** * *** **** *** ** ***
**** * ***** * * **** *****

}

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <string.h>



int main()

{
* * * * * * ** ** ** i,j,l,m=0,n=0,o=0,p[100]={0},q=0,z=0;
* * * ** *** *** ** * word[100], temp, reverse[100];


*** ** * *** *** * * ***** **

    l = strlen(word)-1;


**** ** * ** ** **** = 8; i < l; i++)

    {
**** *** ** **** ** * * ***** ** * ** ** ** * * * == ' ')
** ** ** ** ** * **** * *** *** * * ** ** **** * *
****** *** * * * *** ** *** * * *** * * * *** * *** *** ** ** * * * * **
* ** * * * * ** * * *** * ***** * *** ****** ** ** ** * * ** ** ** *
* ** * * * * * * * * * **** * * ** * *



    }
** ***** * ** ** *

    n = l;
* ** ** ***** * ** *** * *


* * * *** ** * **** * q >=0; q--)
* * * * * * * ***
* * * ** *** ** ** * *** * *** * * * *
* * *** *** * * ** *** *** ** * *** ** * = p[q]; j < l-1; j++)
** **** * * * ** *** ** * * ** ** *** **
* * *** *** * * * *** ** * ** ****** *** ** ** * * *** ** ** * < n)
** * ** ** ** ** ** * * * * * * *** ** ** ** * * * * ** * *
* * ** ** ** * ** ** *** ** *** * **** *** * ** * ** *** * * **** ** * * * ******* ******** * = word[j+1];
* * * ** * * ********* ** ** * * * * * *** * * ** * * *** ** ** *** **** * **** ** *** * ** ***** * *** * * * word[j+1]);
** ** ** * ** * * * **** * *** ** **** * **** * **** ** ** * * * * *****
* *** *** ** ** * * *** ** * * * * ** *** **** * ** * * **** * ** ** * * * *
* * * * ** ** * * * ** ** * ** *** * * * * * *
******** **** * ** * * ** * ** *** * ** * ** * * *
** * * ** *** ** * * * * ***** *** * * * = (l-1) - i;
** ** ****** * ** * * ***** **** * *** *** *** **
* ** * **** * ** **** ***** ** **** ***** *
* * ****** * * ** * *** * * ****** * * ** * **** ** ** * * * **** * ** * ");
* * * ** **** ****** *** * *** ** ***

    }


* ** ** ** * ** **** = 8; i < n; i++)

    {
**** * * * * ****** * ***** ** ** ** *** * * * * * ** * * ** ***

    }


* **** ** ** * * * * ** 0;

}
answered by (-48 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <string.h>



int main()

{
* *** * ***** ** ** * i,j,l,m=0,n=0,o=0,p[100]={0},q=0,z=0;
**** * ** **** **** *** word[100], temp, reverse[100];


* ****** * * ** * **** **

    l = strlen(word)-1;


* *** ** * * * **** ** = 8; i < l; i++)

    {
*** ** * * * * **** * * * ** *** * * ** == ' ')
** *** *** ***** **** ***** * ***
* * * ** * ** ** **** * * * * * * * ** *** * *** * * * * *** * * * *
* *** * ***** * ** ** * * * ******** *** ** ** * * *
** * ** * * * * ** ** * ** * * * ** * ***



    }
* * * *** ** ** ** *

    n = l;
** * ** * ** *** ** ***


*** ** ** * ** ** ***** * q >=0; q--)
**** ** **** *
** *** ***** ** ** *** * * * **** **
* * * *** * * ** ** * *** * ** *** * *** = p[q]; j < l-1; j++)
*** ** ** ** ** * * * * * *** * **** * *******
** ****** * ****** *** *** * ** ******* ******* **** * *** * < n)
*** **** * *** *** * * **** *** ** ** * ** * * * * * * * *
** *** ****** * **** * ** * **** ** *** * ** * *** *** ** ***** * ** ***** * ** *** ** * * = word[j+1];
* ** ** * ** ****** * *** ** * * ***** * * ** ***** * ** *** * *** * * *** * **** ****** ***** * word[j+1]);
** ****** *** *** * ** ** * ** * * * * * * ** * * * ** * **** * ** ** * * ** **
* ** ** * ** * ** * * ** ** * ** * * * *** ** **** **** * * *** ** * *** * * * * ***
*** ** * ** ** * ****** ** * ** * ** * ** * ** ** *
*** **** **** * * ** ***** ** * ** *******
* * ** *** ** ** ** *** ** * ** * = (l-1) - i;
* * * ** * *** * * ***
* ** *** * *** ** **** * * * ** ** **** * **
** * * ** * *** ******* *** *** * ** *** ** * * * * * * ** * * ");
*** ** * * *** *** * * **** * *****

    }


* * * * *** ** ** * ** * * * = 8; i < n; i++)

    {
* * *** *** ** ** ** *** ****** ***** * * ** ** * * * * ** ** ***

    }


**** * ********* * * * * * 0;

}
answered by (20 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <string.h>



int main()

{
* ** ***** * * * i,j,l,m=0,n=0,o=0,p[100]={0},q=0,z=0;
* *** **** * *** * ** *** word[100], temp, reverse[100];


* ***** ** ** ** ** ***

    l = strlen(word)-1;


**** * * ** ** * ** * ** * = 8; i < l; i++)

    {
** *** * ** ** *** ** ** * * * * * * * * ** *** ** * == ' ')
** ** * ** * ** ** * * **** * * **** ** *
* *** * ** ******** ****** ***** *** * *** * ** ****** * * * *** **
* ** ** ** * * ** * * ** ***** ***** ** * * * * * * * * **
****** * ** * * ** * * ** ***** * ** * * * *



    }
** * * ** * *** **

    n = l;
* **** ** * **** **


* * **** * * ** **** * * **** ** q >=0; q--)
*** **** *** * **** **
****** * ** * * * * * ** ** ***** *
** ** * * *** * ** * ** * * *** * ** *** = p[q]; j < l-1; j++)
*** * ** * * **** * * ****** * * * ***
* *** *** * * * * * **** ** * ** ** * ** ** * *** **** ** ** < n)
* * * ** *** * * ** ** ** * ** * ***** * * ** *** * ******
** ** * ** * * * * * * **** * *** * ****** * * * ** *** *** * * * ** * * * **** *** * * * * **** = word[j+1];
*** ** * *** * * ** ** ** **** * * * ** * ** * * *** ** ** * * * * ** * * * ** * * *** * ****** ***** word[j+1]);
** *** * *** * ** ** ** *** * ** **** * ** *** * * ******** *** ** ** ** **** *** *** ** *
* * *** * ** * * ** * ** *** ** ** * * * * * * ** * * * *** ** * *** * ** * * *
**** *** * * * * *** * ** ** * * * * * * * ** **** ** *** *
** ** * * * *** * ** **** * *** *** *****
** ** * * * **** * * *** * = (l-1) - i;
*** * *** **** ** * * * ** ** *** * *
** ** * * * * * *** * *** * * * * * * *
* * * ** ** *** *** * ** ** **** * ** ** ** * *** * ** ** * ***** * ");
* * * *** * ** * * * ** * *

    }


* ****** * * ***** * = 8; i < n; i++)

    {
* * *** * **** *** **** * * * ** ** *** ** ****** * ****

    }


** * ** ** * * *** * ** 0;

}
answered by (38 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <string.h>



int main()

{
** * ** ** * * * * i,j,l,m=0,n=0,o=0,p[100]={0},q=0,z=0;
*** ** ** * ** ***** *** * word[100], temp, reverse[100];


*** ** * * ** ***** * * ***

    l = strlen(word)-1;


* * ** *** ** *** * = 8; i < l; i++)

    {
* * ** *** * * *** * * **** * * * ***** * *** * ** == ' ')
***** * * **** *** * * ** * *** * * * * * *
**** ***** ***** ** ** * ** * ****** * * * * ** ******* * * ** **
* * * **** * * ** * * ** *** * * ******** * * * ** * **** * * ** *** * *
** ** * ** ******* ** * *** * * * *****



    }
*** * ***** * * *** *

    n = l;
* * ** * **** ** * * * *


* * * * **** **** * ** ** * * q >=0; q--)
** * ***** *** * * *
*** * *** *** * ***** *** * **** **** * **** *
* *** * * ** ****** * ** ** * ** * * = p[q]; j < l-1; j++)
** ** ** * * ** ** * ** * ** * * ** * **
*** * *** ** ** *** * * ** * * ** * * * * ** ** * * * * * * * * < n)
*** * ** ** * **** *** * * *** **** **** *** * *** ** ** * *
*** * **** **** * * **** *** * * ** ** * **** ** * ** * * *** ***** ** ** * ** = word[j+1];
** * *** * * ** ** * * ** ** * ** *** * * * *** **** * * *** * * * * ** * ** * ** * * *** * ***** * word[j+1]);
* ** * * * * **** **** * **** *** ****** ****** ** ********* *** *** ** ** *** * *** *** ** *
** * ** **** * ** *** ** **** * *** * * *** *** * * * * * * ** * * * * *** ***** * **** **
* * ** ** * **** * **** * ** ** ** * ** * * * ** *** **
*** * *** ******* * * ***** * *********
* * * * ** * * ** ** **** * *** *** = (l-1) - i;
* * * ** ** ** *** * ******* * * * * ** *** * ******
** ** ** ** * * * * ** *** * * ** * ** * * ***
* ** * * ******* * ** ** ***** ** * * ** * * * *** ** * *** * *** ** * * * ** ");
* ** ** * ** * ** * * * * ** ********* * *

    }


** * *** * * ** * ** = 8; i < n; i++)

    {
** * *** ** * *** *** ** ** * * * ** ** **** * * ** **** *****

    }


* ** *** * * * ** *** * 0;

}
answered by (6 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.6.128
©2016-2025

Related questions

0 like 0 dislike
50 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22973 - Available when: Unlimited - Due to: Unlimited
| 4.5k views
0 like 0 dislike
111 answers
asked Mar 16, 2017 in C by thopd (12.1k points) | 9.1k views
0 like 0 dislike
87 answers
[Exercise] Coding (C) - asked Mar 2, 2017 in C
ID: 22313 - Available when: Unlimited - Due to: Unlimited
| 6.7k views
0 like 0 dislike
82 answers
[Exercise] Coding (C) - asked Mar 9, 2017 in C by thopd (12.1k points)
ID: 22674 - Available when: Unlimited - Due to: Unlimited
| 6.2k views
0 like 0 dislike
18 answers
[Exercise] Essay (Open question) - asked Apr 20, 2017 in C
ID: 24219 - Available when: Unlimited - Due to: Unlimited
| 2.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users