Question: I am learning to use C in my operating systems class and this is what I have so far for my function to find the intersection of two arrays.

An intersection basically is when you take two sets and you get ONLY the elements that are in both sets.

So for example if set A contains = {1,2,3} and set B contains = {2,3,4} then the intersection of A and B are {2,3}. I'm trying to create a function in C that gets two arrays and returns an array containing integers that are in both passing arrays.

I think I almost have the solution here, but I'm getting an error that says:
"identifier 'count' is undefined" 

```
    int intersection(int array1[4], int array2[4])
    {       
        int arrayReturn[sizeof(array1) + sizeof(array2)]
        int count = 0;

        for(int i = 0; i < 4; i++)
        {
            for(int j = 0; j < 4; j++)
            {
                if(array1[i]==array2[j])
                {
                    count = count + 1;
                    arrayReturn[count] = array1[i];
                }
            }
        }

    }

```

I'm very used to Java and I feel like Java and C are nearly identical. I can't really find what's wrong here since count is well within its scope inside the if statement. I don't see how count is undefined.

What's wrong with count and how could I fix this intersection function?

Answer: 
You are missing a semi-colon in the line before `count` declaration.

```
  int arrayReturn[sizeof(array1) + sizeof(array2)]; //Semicolon Here
  int count = 0;

```

---

How did I see the error ?
The error message was `identifier 'count' is undefined` so the first thing I checked for is the cause that the compiler told me. That however was not the problem, as the declaration is there, and in the correct scope. So, now what should I do ? I should look at the line just before the initialization of the variable and at the line just before the usages. This is where you will most certainly find the error.

In short, when the compiler messages don't seem helpful, don't stop. Look around.

---

Also, as GRAYgoose124 points out, you should have a return statement at the end of your function body as your function is supposed to return an integer.
As AshRj points out, you are missing a semicolon.

Tip: The [clang](http://clang.llvm.org/) compiler is excellent at giving diagnostic output. If you try to compile your code with it, you get the following output:

```
source.c:3:57: error: expected ';' at end of declaration
        int arrayReturn[sizeof(array1) + sizeof(array2)]
                                                        ^
                                                        ;

```

Even if you're not compiling your project with clang normally, you can try to compile snippets to help you find out what's wrong. That's what I did with your snippet, as you [can see here](http://liveworkspace.org/code/NCn3U%240). (Note the warnings as well.)