Advertisement
DraKiNs

[COD] string unpack algorithm

Aug 19th, 2011
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.46 KB | None | 0 0
  1. //======== Função =========
  2.  
  3. unPack(str1[], str2[])
  4. {
  5.     for(new i ; str1{i}; ++i)
  6.     {
  7.         str2[ i] = str1{i};
  8.     }
  9.     return str2;
  10. }
  11.  
  12. //======= [ Exemplo ] ========
  13.  
  14.  
  15. new
  16.     inputStrng[11 char],
  17.     outputString[12]
  18. ;
  19.    
  20. inputStrng = !"Hello World";
  21. unPack(inputStrng, outputString);
  22.    
  23. for(new i; outputString[ i]; ++i)
  24. {
  25.     printf("%c", outputString[ i]); //não ocorre array index out of bounds
  26. }
  27.  
  28.  
  29. // Criado por Bruno da Silva
  30. // www.ips-team.blogspot.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement