Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <string.h>
  2. #include "bra_funktioner.h"
  3.  
  4. reverse (char str[]) //ingen typ
  5. {
  6.   int i, len = strlen(str); char tmp;
  7.   for(i=0;i<len;i++)
  8.     { 
  9.         tmp=str[i];
  10.         str[i]=str[len­i]; // str(len-0) (i=0) => då kmr str[len] = \0 ) , str[0] kmr aldrig att nås
  11.         str[len­i]=tmp; 
  12.     }
  13. }
  14. reverse_all_strings(char str[][], int n) { //ingen typ angiven, stolek på andra arrayen
  15.   int i;
  16.   for(i=0;i<n;i++)reverse(str[i]);
  17. }
  18. main()
  19. {
  20.   char str[3][30];
  21.   int number_of_strings; //inget värde angivet
  22.   input_all_strings(str,number_of_strings);
  23.   reverse_all_strings(str,number_of_strings);
  24.   output_all_strings(str,number_of_strings);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement