SHARE
TWEET

latian pointer

a guest Nov 15th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3. void tukar(int *a,int *b)
  4. {
  5.     int temp = *a;
  6.     *a=*b;
  7.     *b=temp;
  8. }
  9. void inputStr(char kata[],char target[])
  10. {
  11.     strcpy(target,kata);
  12. }
  13. void inputstrN(char kata[],int jumlah)
  14. {   int i;
  15.     char aingkata[100];
  16.     for(i=0;i<jumlah;i++)
  17.     {
  18.         scanf("%c",aingkata[i]);
  19.     }
  20.     //printf("%s\n",aingkata);
  21.     strcpy(aingkata,kata);
  22. }
  23. void inputIn( int nilai, int *a)
  24. {
  25.     *a=nilai;
  26. }
  27. int main()
  28. {
  29.     int a,b;
  30.    
  31.     inputIn(69, &a);
  32.     inputIn(96, &b);
  33.    
  34.     tukar(&a,&b);
  35.     printf("%d %d\n",a,b);
  36.    
  37.     char str[100];
  38.     inputStr("anjay",str);
  39.     printf("%s\n",str);
  40. //  getchar();
  41.    
  42.     inputstrN(str,5);
  43.         printf("%s\n",str);
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top