# Memory Game in C Programming

**URL:** <https://forum.kirupa.com/t/memory-game-in-c-programming/253377>\
**Category:** programming\
**Created:** [February 29, 2008, 4:19pm UTC](https://forum.kirupa.com/t/memory-game-in-c-programming/253377 "2008-02-29T16:19:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polaris](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@Polaris](https://forum.kirupa.com/u/Polaris)\
**Post date:** [February 29, 2008, 4:19pm UTC](https://forum.kirupa.com/t/memory-game-in-c-programming/253377/1 "2008-02-29T16:19:12Z")

</div>

Another assignment I have is to build a Memory game.

[http://www.egr115.com/prog05\_memory.pdf](http://www.egr115.com/prog05_memory.pdf)

…and the code I am given to work with is…

#include “stdio.h”  
#include “stdlib.h”  
#include “memory.h”

int main()  
{  
int grid[5][6];  
int matched[5][6];

```
int i=0, j=0;

// Generate the grid 
Generate(grid); 

```

// Generate the matched grid  
for (i=0; i\<5; i++)  
{  
for (j=0; j\<6; j++)  
{  
if (i==0 || j==0 || i==j)  
{  
matched\*[j] = 0;  
} // end of if

```
         else 
         {
              matched*[j] = 1; 
         } // end of else 

   } // end of for j 

} // end of for i 

// Display the grid
Display(grid, matched); 

 system("pause");

```

} // end of main()

This is an example of what it is suppose to look like.

[http://www.egr115.com/prog05distrib.exe](http://www.egr115.com/prog05distrib.exe)
