Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. int main() {
  5.  
  6. /* int license[20];
  7. char* hex = "e3e3",*p;
  8. int used = 0;
  9. int i = 0;
  10. int l1;
  11. while((sscanf(hex+used,"%x",&license[i]))==1)
  12. {
  13. printf("%d ",license[i]);
  14. i++;
  15. used += 4;
  16. }
  17. l1=strtol(hex,&p,16);
  18. printf("%d",l1);*/
  19. /*char hex[] = "6A4e32"; // here is the hex string
  20. int num = (int)strtol(hex, NULL, 16); // number base 16
  21. printf("%c\n", num); // print it as a char
  22. printf("%d\n", num); // print it as decimal
  23. printf("%X\n", num); // print it back as hex
  24. int y;
  25. char w1,w2;
  26. int e1,e2,y,i;
  27. scanf("%d",&y);
  28. for(i=1;i<=y;i++){
  29. scanf("%c %c",&w1,&w2);
  30.  
  31. scanf("%d %d",&e1,&e2);
  32. scanf("\n");
  33.  
  34. if(w1=='M'){
  35. aux=realloc(a[e1],4*(x[e1]+e2)*sizeof( unsigned int));
  36. scanf("%x",&ds);
  37. for(int k=1;k<=e2/4;k++)
  38. x[e1]++;
  39. a[e1][x[e1]]=ds;
  40.  
  41. }
  42. if(w1=='D')
  43. {
  44. //scanf("%x",&ds);
  45.  
  46. }
  47.  
  48.  
  49. }*/
  50. int x[100],i,j,n;
  51. scanf("%d",&n);
  52. char ***a,vb[10],mb,bv[10];
  53. double r;
  54. a=malloc(200*n*sizeof(char));
  55.  
  56. for(i=0;i<n;i++)
  57. { scanf("%d",&x[i]);
  58. a[i]=malloc(10*(x[i]+1)* sizeof(char));
  59. for(j=0;j<x[i];j++)
  60. { a[i][j]=malloc(10 * sizeof(char));
  61.  
  62. scanf("%s",a[i][j]);
  63. }
  64. }
  65. //a[5]=realloc(a[5],10*(x[5]+20)*sizeof(char));
  66.  
  67. //a[5]=malloc(10*x[5]*sizeof(char));
  68. //x[5]++;
  69. //a[5]=realloc(a[5],10*x[5]*sizeof(char));
  70. //a[5][x[5]]= malloc(20*sizeof(char));
  71.  
  72. x[5]++;
  73. scanf("%s",vb);
  74. a[5][x[5]]=malloc(20*sizeof(char));
  75. printf("%s",a[5][x[5]]);
  76. //a[5][x[5]]="0000000";
  77. //memcpy(a[5][10],vb,10);
  78. //printf("%s",a[5][x[5]]);
  79. //printf("%s",a[5][x[5]]);
  80. //a[5][x[5]][0]='1';
  81. //memcpy(a[5][x[5]],"000000",10);
  82. //printf("%s",a[5]);
  83. //scanf("%s",vb);
  84. //strcpy(a[5][x[5]],vb);
  85. //memcpy(a[5][x[5]-1],vb,10);
  86. //x[5]++;
  87. //memcpy(a[5][x[5]],vb,10);
  88. //printf("%c",a[5][x[5]-1][0]);
  89. // memcpy(a[5][x[5]],vb,10);
  90. //strcpy(a[5][x[5]],vb);
  91. for(i=0;i<n;i++){
  92. for(j=0;j<x[i];j++){
  93. printf("%s ",a[i][j]);
  94. }
  95. printf("\n");
  96. }
  97.  
  98. return 0;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement