DEKTEN

For_Heroseh_001_C11

Dec 30th, 2020 (edited)
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.87 KB | None | 0 0
  1.  
  2. /** ******************************************************** ***
  3.  
  4.     Hello heroseh, I noticed you did a thing a few minutes
  5.     (30+) ago? I've done the same thing. I decided to look
  6.     it up and see what I could find. CTRL+F on the spec
  7.     didn't help, probably because I didn't know what I was
  8.     looking for, but these stack overflow posts had
  9.     information. Also did this example program for you.
  10.  
  11.     https://stackoverflow.com/questions/18820751/
  12.    
  13.     https://stackoverflow.com/questions/693788/
  14.  
  15.     Self: https://pastebin.com/2bMRsamk
  16.  
  17. *** ******************************************************** **/
  18. /** ******************************************************** ***
  19.  
  20.     Type List:              
  21.     int sum(int,int);         <------ declaration  
  22.                              
  23.     Parameter-Type list:      
  24.     int sum(int a , int b );  <------ declaration  
  25.                              
  26.     Parameter list:          
  27.     int sum( a , b );         <------ declaration  
  28.  
  29. *** ******************************************************** **/
  30.  
  31.     int f_1(           ){  /** unspecified # args **/ return 1; }
  32.     int f_2(   void    ){  /** no arguments.      **/ return 1; }
  33.     int f_3( int a ,...){  /** varadic function.  **/ return a; }
  34.  
  35.     //: f_4: K&R Weirdness for declaring functions
  36.     int f_4(a, b, c) //:<-- Parameter List
  37.     int a;
  38.     int b;
  39.     int c;
  40.     {
  41.       return ( a + b + c );
  42.     }
  43.  
  44. #include <stdio.h>  
  45. int main( void ){
  46.  
  47.     f_1(           );
  48.     f_1( 1         );
  49.     f_1( 1 , 2 , 3 );
  50.  
  51.     f_2(           );
  52. //: f_2( 1         ); //: too many arguments to function 'f_2'
  53. //: f_2( 1 , 2 , 3 ); //: too many arguments to function 'f_2'
  54.  
  55. //: f_3(           ); //: too few  arguments fo function 'f_3'
  56.     f_3( 1         );
  57.     f_3( 1 , 2 , 3 );
  58.  
  59.     f_4( 1 , 2 , 3 );
  60.  
  61.     printf("[End_Of_The_World]\n");
  62. }
Add Comment
Please, Sign In to add comment