Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 27th, 2012  |  syntax: None  |  size: 1.08 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. passing of strings in C function
  2. #include "stdafx.h"
  3. #include "stdio.h"
  4. #include "conio.h"
  5. #include "stdlib.h"
  6.  
  7. int Check_Anagram(char*,char*);
  8.  
  9. void main()
  10. {
  11.     char words[10][20];
  12.     int i;
  13.     int flag;
  14.     for(i=0;i<3;i++)
  15.     {
  16.         scanf("%sn",words[i][20]);
  17.     }
  18.     for(i=1;i<10;i++)
  19.     {
  20.         flag = Check_Anagram(words[i][20],words[i-1][20]);      
  21.     }
  22.     getch();
  23. }
  24.  
  25. int Check_Anagram(char *a,char *b)
  26. {
  27.     printf("%s %sn",a,b);
  28.     return 1;
  29. }
  30.        
  31. for(i = 1; i < 3; i++) /* i < 3 */
  32. {
  33.     flag = Check_Anagram(words[i], words[i-1]);
  34. }
  35.        
  36. flag = Check_Anagram(words[i],words[i-1]);
  37.        
  38. for(i=0;i<10;i++)
  39. {
  40.     scanf("%sn",words[i]);
  41. }
  42.        
  43. #include "stdafx.h"
  44. #include "stdio.h"
  45. #include "conio.h"
  46. #include "stdlib.h"
  47.  
  48. int Check_Anagram(char [],char []);
  49.  
  50. void main()
  51. {
  52.     char words[10][20];
  53.     int i;
  54.     int flag;
  55.     for(i=0;i<3;i++)
  56.     {
  57.         scanf("%sn",words[i]);
  58.     }
  59.     for(i=1;i<10;i++)
  60.     {
  61.         flag = Check_Anagram(words[i],words[i-1]);      
  62.     }
  63.     getch();
  64. }
  65.  
  66. int Check_Anagram(char a[],char b[])
  67. {
  68.     printf("%s %sn",a,b);
  69.     return 1;
  70. }