Advertisement
zsoltizbekk

valtozodekl

Apr 13th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. char *cdecl( char *p, int x)
  7. {
  8.     char *z;
  9.     int h1;
  10.     h1=sizeof(p);
  11.     z=(char *)malloc((h1+100000)*sizeof(char));
  12.     sprintf(z,"int %s = %d;",p,x);
  13.     return (char *)z;
  14. }
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. int main()
  19. {
  20.   char s[ 1000 ];
  21.   int n;
  22.   char *cdecl( char *, int );
  23.   while ( scanf( "%s%d", s, &n ) != EOF )
  24.   {
  25.     char *p = cdecl( s, n );
  26.     puts( p );
  27.     free( p );
  28.   }
  29.   return EXIT_SUCCESS;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement