interpretation

This is a discussion on interpretation within the C Programming forums, part of the General Programming Boards category; Code: #include<stdio.h> #define ROWS 3 #define COLUMNS 4 void sub1 ( int z[][COLUMNS]); void main() { int a,b; static int ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    73

    interpretation

    Code:
            #include<stdio.h>
    
            #define ROWS 3
            #define COLUMNS 4
    
            void sub1 ( int z[][COLUMNS]);
    
    		void main()
    
    
    		{
    		   int a,b;
    		   static int z[ROWS][COLUMNS] = {1,2,3,4,5,6,7,8,9,10,11,12};
    
    		   sub1(z);
    
    		  
    		    for(a=0;a<ROWS; ++a)
    
    			{
    			      for(b=0;b <COLUMNS; ++b)
    
    				  printf("%d\n", z[a][b]);
    			}
    
    		   
    		}
    
    		void sub1( int x[][COLUMNS])
    
    		{
    		 
    			
    		    int a,b;
    		    for(a=0;a<ROWS; ++a)
    
    			 for(b=0; b<COLUMNS; ++b)
    
    				 if((x[a][b] % 2)==1) 
    					 
    			       x[a][b]--;
    
    				 return;
    
    		}

    the program is correct . what is the meaning of x[a][b]-- here , specially -- sign ?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    Well what do you think the ++ in ++a and ++b does?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    73
    Salem @ ohh i got ... thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interpretation to this Question attached
    By Donaldstr in forum C Programming
    Replies: 4
    Last Post: 11-02-2009, 01:15 AM
  2. Storage and interpretation of double precision numbers
    By KBriggs in forum C Programming
    Replies: 5
    Last Post: 08-12-2009, 01:40 PM
  3. goto statement interpretation in VC 6 and 7
    By w262 in forum C++ Programming
    Replies: 2
    Last Post: 02-28-2005, 09:37 PM
  4. Open for interpretation
    By spoon_ in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-16-2004, 09:00 PM
  5. interpretation of a question
    By jibbles in forum C Programming
    Replies: 11
    Last Post: 08-08-2004, 03:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21