Guest User

Untitled

a guest
Jun 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. struct Node
  2. {
  3. Data *data;
  4. Node *next;
  5. }
  6.  
  7. // this is efficient
  8. for (int i=0; i< n; i++)
  9. {
  10. strcat(str, data(i));
  11. }
  12.  
  13. // this could be too, but you'd need to look at the implementation to be sure
  14. std::string str;
  15. for (int i=0; i<n; i++)
  16. {
  17. str+=data(i);
  18. }
  19.  
  20. String result = "";
  21. for (int i = 1; i <= n; i++) {
  22. result = result + Integer.toString(i);
  23. }
  24.  
  25. char *result = malloc(1);
  26. *result = '';
  27. for (int i = 1; i <= n; i++) {
  28. char *intStr = malloc(11);
  29. itoa(i, intStr, 10);
  30. char *tempStr = malloc(/* some large size */);
  31. strcpy(tempStr, result);
  32. strcat(tempStr, intStr);
  33. free(result);
  34. free(intStr);
  35. result = tempStr;
  36. }
  37.  
  38. a = a + b
  39.  
  40. def foo(l=[])
  41. l.append("bar")
  42. return l;
Add Comment
Please, Sign In to add comment