Haskell, 102 100 96 91 87 bytes
c s=unlines.f$f.(#)where f=(<$>[1..s]);x#y|elem y[1,s,x]||elem x[1,s,s-y+1]='*'|1>0=' '
- Saved 2 bytes, thanks to flawrflawr.
- Saved 4 more bytes by using list comprehensions.
- 5 bytes saved combining flawrflawr's improvement with
any
- 4 bytes saved by replacing
any
withelem
Ungolfed version:
cross :: Int -> String
cross s = unlines $ map line [1..s]
where line y = map (pos y) [1..s]
pos y x | x == y = '*'
| x == s - y + 1 = '*'
| y `elem` [1, s] = '*'
| x `elem` [1, s] = '*'
| otherwise = ' '
I'm sure this can still be improved, but this is what I've come up with for now.
Old version:
c s=unlines.f$f.(#)where f=(<$>[1..s]);x#y|any(==y)[1,s,x]||any(==x)[1,s,s-y+1]='*'|1>0=' '