You never assign x to point to anything, so it just points at random memory. Then you try to read from that random memory. I don't know what you expected to happen; it's undefined behavior.
Well, after you get the dimensions from the user, you need to actually allocate the array. You can either use a 1D array and use math to treat it as a 2D array, or you can use an array of arrays which takes more work but might be easier to think about. Remember you also have to free the memory when you're done with it.