please dont rip this site

Language Ccpp Cref Examples POINTER2_FUNC.C

/ *
 * Purpose: Program to demonstrate passing an int array to a function.
 * Author:  M J Leslie.
 * Date:    14-Apr-94
 */

void add(int swap[3][2]); 		/* Function declaration	*/
void display(int array[3][2]); 		/* Function declaration	*/

main()
{
  int i[3][2]=
  {
    {1,2},			/* array declaration 	*/
    {3,4},
    {5,6}
  };

  display(i);				/* i is a pointer	*/

  add(i);

  display(i);
}

/***************************************************************/

void add(int swap[3][2]) 		/* Function definition 	*/
{
  int temp,i;

  for (i=0; i<3; i++)
  {
    temp       = swap[i][0];
    swap[i][0] = swap[i][1];
    swap[i][1] = temp;
  }
  return;
}

/***************************************************************/

void display(int array[3][2]) 		/* Function definition 	*/
{
  int count=0,count1=0;

  for (count=0;count<3;count++)
    for (count1=0;count1<2;count1++)
      printf("%d ", array[count][count1]);
  puts("");
}


file: /Techref/language/ccpp/cref/EXAMPLES/pointer2_func.c, 0KB, , updated: 1997/4/21 09:52, local time: 2024/4/25 01:41,
TOP NEW HELP FIND: 
3.133.131.168:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.massmind.org/techref/language/ccpp/cref/EXAMPLES/pointer2_func.c"> language ccpp cref EXAMPLES pointer2_func</A>

Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to www.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .