[Question]
  [
# Challenge
Create the shortest program that meets the requirements
## Requirements
1. The code must generate a 5x5 grid of 0s, like so:
```
00000
00000
00000
00000
00000
```
2. The code must accept an input (column, row, character). The grid must change accordingly:
Start:
```
00000
00000
00000
00000
00000
```
Input:
```
(2,5,*)
```
Output:
```
0*000
00000
00000
00000
00000
```
(Note: the bottom-left corner is position 1,1.)
3. The program must return an error message other than the grid if the row/column input is not 1,2,3,4, or 5. This can be any message of your choice (as long as it's not the grid), so `0` is an acceptable error-output.
4. The program must work with all printable ASCII characters (of a US keyboard).
## THE WINNER
The winner will be the person who has the shortest code and fulfills all requirements. If more than one answer works and has the same (shortest) length, the person who answered first will be the winner.
  
[Answer]
# [Dyalog APL](https://www.dyalog.com/), ~~17~~ ~~13~~ 10 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
Prompts for an enclosed array containing (row, column) and then for a character. Gives INDEX ERROR on faulty input.
```
⊖⍞@⎕⊢5 5⍴0
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKPdvSgz5f@jrmmPeuc5POqb@qhrkamC6aPeLQYgyf8KYABSw/Woq8lIwZRLCwA "APL (Dyalog Unicode) – Try It Online")
`⊖` flip upside-down the result of
`⍞` inputted-character
`@` replacing the content **at** position
`⎕` evaluated-input (enclosed row, column)
`⊢` of
`5 5⍴` 5×5 array of
`0` zeros
[Answer]
## Ruby, ~~157~~ 149 bytes
```
g=(1..5).map{[0]*5}
loop{puts g.map(&:join).join ?\n
x=gets.match /\((.),(.),(.)\)/
a,b=x[1].hex,x[2].hex
1/0 if a<1||a>5||b<1||b>5
g[5-b][a-1]=x[3]}
```
Error on malformed input or out of bound position
Thanks to ConorO'Brien (8 bytes) and afuous (2 bytes) for helping saving bytes
[Answer]
## Batch, 199 bytes
```
@echo off
if %1 gtr 0 if %1 lss 6 if %2 gtr 0 if %2 lss 6 goto g
if
:g
for /l %%j in (5,1,-1)do call:l %* %%j
exit/b
:l
set s=000000
if %2==%2 call set s=%%s:~0,%1%%%3%%s:~%1%%
echo %s:~1,5%
```
Errors out if the position is out of range.
[Answer]
# PHP, ~~111~~ ~~100~~ 97 bytes
```
$s=str_repeat("00000\n",5);$s[($x=($a=$argv)[1])+29-6*$y=$a[2]]=$a[3];echo$x&&$y&&$x<6&$y<6?$s:E;
```
prints `E` if row/column out of range.  
Run with `php -r <code> <row> <column> <character>`
[Answer]
## Python, 66 bytes
```
lambda a,b,n,l='00000\n':6>b>0<a<6and(5-b)*l+l[:a-1]+n+l[a:]+~-b*l
```
[Answer]
# Dyalog APL, ~~24~~ ~~20~~ 18 bytes
Saved 4 bytes thanks to Zgarb! Saved 2 bytes thanks to Adam!
```
a←5 5⍴0⋄a[⊂⎕]←⍞⋄⊖a
```
Prompts for input. See below for an explanation.
---
## 20 bytes
```
{a←5 5⍴0⋄a[⊂⍺]←⍵⋄⊖a}
```
Assign to a function and call it `y x f 'c'`. E.g.:
```
      f←{a←5 5⍴0⋄a[⊂⍺]←⍵⋄⊖a}
      5 2 f '*'
0 * 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
      6 6 f '*'
INDEX ERROR                   
     ←{a←5 5⍴0 ⋄ a[⊂⍺]←⍵ ⋄ ⊖a}
               ∧              
      0 0 f '*'
INDEX ERROR                   
     ←{a←5 5⍴0 ⋄ a[⊂⍺]←⍵ ⋄ ⊖a}
               ∧   
```
## Explanation
```
{a←5 5⍴0⋄a[⊂⍺]←⍵⋄⊖a}
```
`{...}` is a function with left argument `⍺` and right argument `⍵`. `⋄` separates statements, so there are three statements:
```
a←5 5⍴0⋄a[⊂⍺]←⍵⋄⊖a
```
The first statement `a←5 5⍴0` sets `a` to a `5` by `5` grid of `0`s.
The second statement sets the member at coordinates dictated by `⍺` to `⍵` (that is, the character).
Finally, we perform `⊖` on `a` and return that, yielding the firsts of `a` reversed.
[Answer]
## JavaScript (ES6), ~~73~~ 76 bytes
Throws a `TypeError` if the column or the row is out of range.
```
(c,r,C,a=[...`00000
`.repeat(5)])=>(a[29+c-r*6]=C,c<1|r<1|c>5|r>5||a).join``
```
### Demo
```
let f =
(c,r,C,a=[...`00000
`.repeat(5)])=>(a[29+c-r*6]=C,c<1|r<1|c>5|r>5||a).join``
console.log(f(2,5,'*'));
```
[Answer]
# C#, 199 Bytes
Based on Pete Arden's answer
```
string g(int c, int r, char a){if(c<1|c>5|r<1|r>5)return "Index Error";var b="00000";var d=new[]{b,b,b,b,b};c--;d[r-1]=new string('0',c)+a+new string('0',4-c);return string.Join("\r\n",d.Reverse());}
```
Ungolfed:
```
public static string G(int c, int r, char a)
    {
        if (c < 1 || c > 5 || r < 1 || r > 5) return "Index Error"; // Check it's not out of range
        var b = "00000";
        var d = new [] { b, b, b, b, b };                           // Generate display box, and fill with the default character
        c--;                                                        // Convert the X to a 0 based index
        d[r - 1] = new string('0',c) + a + new string('0',4-c);     // Replace the array's entry in y coordinate with a new string containing the new character
        return string.Join("\r\n", d.Reverse());                    // Reverse the array (so it's the right way up), then convert to a single string
    }
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~27~~ 22 bytes
Returns no grid when row/column > 5.
```
‚6‹Pi25L²<5*¹+Q5äR»1³‡
```
[Try it online!](http://05ab1e.tryitonline.net/#code=4oCaNuKAuVBpMjVMwrI8NSrCuStRNcOkUsK7McKz4oCh&input=Mgo1Cio)
**Previous version**
```
‚6‹Pi26G¾5²<*¹+NQi\³}})5äR»
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 28 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
This feels way too long...
```
Ṫ0ẋ24¤;ṙÑs5UY
’ḅ5
Ṗḟ5R¤
-ÑÇ?
```
**[TryItOnline!](http://jelly.tryitonline.net/#code=4bmqMOG6izI0wqQ74bmZw5FzNVVZCuKAmeG4hTUK4bmW4bifNVLCpAotw5HDhz8&input=&args=WzUsMiwnKidd)**
### How?
```
Ṫ0ẋ24¤;ṙÑs5UY - Link 1, make grid: [row, column, character] e.g. [5,2,'*']
Ṫ             - tail: character                                  '*'
     ¤        - nilad followed by link(s) as a nilad  
 0            -     zero
  ẋ           -     repeated
   24         -     24 times                                     [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
      ;       - concatenate:                                     "000000000000000000000000*"
        Ñ     - call next link (2) as a monad                    21
       ṙ      - rotate left by                                   "000*000000000000000000000"
         s5   - split into chunks of length 5                    ["000*0","00000","00000","00000","00000"]
           U  - upend (reveres each)                             ["0*000","00000","00000","00000","00000"]
            Y - join with line feeds                              0*000
              - implicit print                                    00000
                                                                  00000
’ḅ5 - Link 2, position: [row, column]                             00000
’   - decrement                                                   00000
 ḅ5 - convert from base 5
Ṗḟ5R¤ - Link 3, input error checking: [row, column, character]
Ṗ     - pop: [row, column]
 ḟ    - filter out values in
  5R¤ - range(5): [1,2,3,4,5] - any values not in this remain giving a truthy result
-ÑÇ? - Main link: [row, column, character]
   ? - ternary if:
  Ç  -    last link (3) as a monad
-    -    -1 (if truthy - the error identification)
 Ñ   - next link (1) as a monad (if falsey - the grid)
```
[Answer]
# JavaScript (ES6), 89 bytes
```
f=(X,Y,Z,x=5,y=5)=>x+y>1?(x?X+x-6|Y-y?0:Z:`
`)+f(X,Y,Z,x?x-1:5,y-!x):X<1|X>5|Y<1|Y>5?e:""
```
Because I love recursion. Throws a `ReferenceError` on invalid coordinates.
[Answer]
**Mathematica, 38 bytes**
```
(x=Table[0,5,5];x[[-#2,#]]=#3;Grid@x)&
```
[Answer]
# Brain-Flak 415 Bytes
Includes +3 for `-c`
```
([][()()()]){{}}{}({}<(({}<(({})<>)<>>)<>)<>([((((()()()){}){}){}){}]{}<([((((()()()){}){}){}){}]{})>)(()()()()()){({}[()]<(({})){{}(<({}[()])>)}{}({}<(({})){{}(<({}[()])>)}{}>)>)}{}({}{}){<>{{}}<>{}}<>>)<>(()()()()()){({}[()]<(((((((((()()()){}){}){}){})))))((()()()()()){})>)}{}{}<>({}<()((((((()()()){}){}()){}){}()[{}])({})({})({})({}){}{}[((((()()()){}){}){}){}()]){({}[()]<<>({}<>)>)}{}<>{}>)<>{({}<>)<>}<>
```
[Try it Online!](http://brain-flak.tryitonline.net/#code=KFtdWygpKCkoKV0pe3t9fXt9KHt9PCgoe308KCh7fSk8Pik8Pj4pPD4pPD4oWygoKCgoKSgpKCkpe30pe30pe30pe31de308KFsoKCgoKCkoKSgpKXt9KXt9KXt9KXt9XXt9KT4pKCgpKCkoKSgpKCkpeyh7fVsoKV08KCh7fSkpe3t9KDwoe31bKCldKT4pfXt9KHt9PCgoe30pKXt7fSg8KHt9WygpXSk-KX17fT4pPil9e30oe317fSl7PD57e319PD57fX08Pj4pPD4oKCkoKSgpKCkoKSl7KHt9WygpXTwoKCgoKCgoKCgoKSgpKCkpe30pe30pe30pe30pKSkpKSgoKCkoKSgpKCkoKSl7fSk-KX17fXt9PD4oe308KCkoKCgoKCgoKSgpKCkpe30pe30oKSl7fSl7fSgpW3t9XSkoe30pKHt9KSh7fSkoe30pe317fVsoKCgoKCkoKSgpKXt9KXt9KXt9KXt9KCldKXsoe31bKCldPDw-KHt9PD4pPil9e308Pnt9Pik8Pnsoe308Pik8Pn08Pg&input=KjEz&args=LWM)
Takes the character to insert first, then the row then column without spaces.
Most of this is just error handling. Brain-Flak doesn't have a good way to check if values are in a range. For errors, it either outputs nothing, or just the character that was supposed to be inserted. Solving the actual problem only takes 211 bytes:
```
<>(()()()()()){({}[()]<(((((((((()()()){}){}){}){})))))((()()()()()){})>)}{}{}<>({}<()((((((()()()){}){}()){}){}()[{}])({})({})({})({}){}{}[((((()()()){}){}){}){}()]){({}[()]<<>({}<>)>)}{}<>{}>)<>{({}<>)<>}<>
```
[Answer]
# Excel VBA, 67 Bytes
Outputs to the range *A1:E5* on the activesheet of the vba project, exits with
> 
> Run-time error '1004':
> 
> 
> Application-defined or object-defined error
> 
> 
> 
when an invalid input is provided.
**Code:**
```
Sub a(c,r,x)
c=IIf(r<1Or c>5,-1,c)
[A1:E5]=0
Cells(6-r,c)=x
End Sub
```
**Usage:**
```
a 4,5,"#"
```
**Output** (from example above)**:**
```
    A   B   C   D   E
1   0   0   0   #   0
2   0   0   0   0   0
3   0   0   0   0   0
4   0   0   0   0   0
5   0   0   0   0   0
```
[Answer]
# C#, 208 Bytes
Golfed:
```
string G(int c,int r,char a){if(c<1||c>5||r<1||r>5)return"Index Error";var b="00000";var d=new string[]{b,b,b,b,b};d[r-1]=d[r-1].Substring(0,c-1)+a+d[r-1].Substring(c);return string.Join("\r\n",d.Reverse());}
```
Ungolfed:
```
public string G(int c, int r, char a)
{
  if (c < 1 || c > 5 || r < 1 || r > 5) return "Index Error";
  var b = "00000";
  var d = new string[] { b, b, b, b, b };
  d[r - 1] = d[r - 1].Substring(0, c - 1) + a + d[r - 1].Substring(c);
  return string.Join("\r\n", d.Reverse());
}
```
Testing:
```
Console.Write(G(6, 6, '*')); //Index Error
Console.Write(G(1, 4, '#'));
00000
#0000
00000
00000
00000
Console.Write(G(5, 5, '@'));
0000@
00000
00000
00000
00000
Console.Write(G(1, 1, '}'));
00000
00000
00000
00000
}0000
```
[Answer]
# WinDbg, 95 bytes
```
j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
```
Almost half of it just verifying the indexes are in range... Input is done by setting the psuedo-registers `$t0`, `$t1`, and `$t2` (where `$t2` holds the ascii value of the char to replace). For example, `(2,5,*)` like the example would be:
```
0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a
```
Prints `0` on error.
How it works:
```
j (0<(@$t0|@$t1)) & (6>@$t0) & (6>@$t1)  * If $t0 and $t1 are both positive and less than 6
'
    f 8<<16 L19 30;                      * Put 19 (0n25) '0's (ascii 30) at 2000000 (8<<16)
    eb 2000018+@$t0-@$t1*5 @$t2;         * Replace the specified cell with the new char
    da /c5 8<<16 L19                     * Print 19 (0n25) chars in rows of length 5
';
    ?0                                   * ...Else print 0
```
Sample Output:
```
0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000  "0*000"
02000005  "00000"
0200000a  "00000"
0200000f  "00000"
02000014  "00000"
0:000> r$t0=-2
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
0:000> r$t0=4
0:000> r$t1=2
0:000> r$t2=23
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000  "00000"
02000005  "00000"
0200000a  "00000"
0200000f  "000#0"
02000014  "00000"
0:000> r$t1=f
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
```
[Answer]
## Haskell, 77 bytes
```
r=[1..5]
(x#y)c|x>0,x<6,y>0,y<6=unlines[[last$'0':[c|i==x,j==6-y]|i<-r]|j<-r]
```
Usage example:
```
*Main> putStr $ (2#5) '*'
0*000
00000
00000
00000
00000
```
If `x` and `y` are within range, outer and inner loop through `[1..5]` and take the char `c` if it hits the given `x` and `y` and a `0` otherwise. If `x` or `y` is not in range, a `Non-exhaustive patterns` exception is raised.
[Answer]
# Octave 49 bytes
```
@(c,r,s)char(accumarray([6-r c],s+0,[5 5],[],48))
```
[Answer]
## [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), ~~53~~ 50 bytes
EDIT: Now that I know that I don't have to show the starting grid, I've swapped out the user inputs `_!_!_?` for command line parameters `::;`, saving 3 bytes.
```
[5|?@00000|]::;~(b>5)+(c>5)>1|_Xd\$LOCATE 6-c,b|?B
```
Original version: This halts between printing the 0-grid and taking the coordinates for the substitution, showing the 0-grid.
```
[5|?@00000|]_!_!_?~(b>5)+(c>5)>1|_Xd\$LOCATE 6-c,b|?B
```
Prints 5 strings of 5 `0`'s, asks user for 2 numerical inputs and 1 string input, checks if the numbers are < 5 and uses QBasic's `LOCATE` function to substitute the right character.
[Answer]
# Java, 99 bytes
```
(i,j,k)->{int[]b=new int[]{60,60,60,60,60};int[][]a=new int[][]{b,b,b,b,b};a[i-1][5-j]=k;return a;}
```
[Answer]
# Bash, 59 bytes
**Golfed**
```
printf '00000%0.s\n' {1..5}|sed "$1 s/./$3/$2"|grep -z "$3"
```
*$1*, *$2* - row, column, *$3* - replacement char, error is reported via exit code
**Test**
```
>./box 2 2 "*"
00000
0*000
00000
00000
00000
>echo $?
0
>./box 6 2 '*'     
>echo $?
1
```
[Answer]
# Vim, ~~60~~ ~~47~~ ~~42~~ 76 keystrokes
Input is in the format (on the first line):
```
25*
```
With the cursor starting at the beginning
```
"ax"bxx:if<C-r>a<1||<C-r>a>5||<C-r>b<1||<C-r>b>5
^
endif
6i0<ESC>Y5pG:norm <C-r>al<C-r>bkr<C-r>-
Hqqxjq5@qdd
```
If the input is invalid, then throws: `E492: Not an editor command: ^`
The cide that produces the output is only `42` bytes, but in order to create an error, my bytecount is drastically increased.
[Answer]
# Java 8, ~~194~~ 192 bytes
```
interface M{static void main(String[]a){String r="";int i=0,j,z=new Byte(a[0]),y=new Byte(a[1]);for(;++i<6;r+="\n")for(j=0;++j<6;r+=6-i==y&j==z?a[2]:0);System.out.print(z>0&z<7&y>0&y<7?r:0);}}
```
[Try it here with correct input.](https://tio.run/##Vc2xDoIwGATgV2k6mFaEVBIZrI1P4MSIHf5AMa3SYikkhvDsFcPkdvkulzMwQep6ZU3zjFHboHwLtUK3eQgQdI0mpxvUgbakDF7bRyWBzltEXmDMW@fJukNasIPhSaIvBfeJwHeL6a8zgq1qNiVFqhOMaabeI7wGAtVR0h0x/8YkvUKVyzOjvPwMQXWZG0PWr6eBeMqXJcaYx1PcfwE)  
[Try it here with incorrect input.](https://tio.run/##Tc29DoIwFAXgV2kYSCs/qQ6QWK4k7k6MyNBgMa2hkFIxxfDsFePidE@@nJOr@MyTYRRa3R7eS22F6Xgr0OU9WW5li@ZB3lDPpcaVNVLf64aT9y8iA0HAtg2SQGMVL6DFC52dFZjXtCGx@4d9Q1g3GMyiSBYZMxEEVx2QLymgm6qfZokEcKECWEpeH5ojJaxykxV9OjxtOm6fLV5ONFyKPHTbdUVemm9rXb331Od@9wE)
This would be **~~116~~ 114 bytes** instead as function instead of full program:
```
(a,b,c)->{String r="";for(int i=0,j;++i<6;r+="\n")for(j=0;++j<6;r+=b==6-i&a==j?c:0);return a>0&a<7&b>0&b<7?r:"0";}
```
[Try it here.](https://tio.run/##dY/BasMwEETv/opFB2PVshGFxhBZyRc0lx7bHlaKE6Q6spHlQAn@dldOTOmll1125rHMWLxi0fWNs8evWbc4DPCKxt0SAONC40@oGzgsJ8Bb8MadQWfRAWQLAIr9ylREakriGAIGo@EADiTMGTLFNC12t5X0khBx6vz9j5GcWZHnpt4In0vy4QhdPCt5VO1DVVJuCpOilHavt5wK34TRO8AdT7GuUhW3qqu93xJOxDSLJUU/qjamWMNcO3OES6yWPVK8fwLStdf3EJpL2Y2h7KMVWpe5UmfPDF4YkCdC783@5TiD6g83JdP8Aw)
**Explanation:**
```
interface M{                  // Class
  static void main(String[]a){//  Mandatory main-method
    String r="";              //   Result-String, starting empty
    int i=0,j,                //   Index-integers
        z=new Byte(a[0]),     //   First input converted to integer
        y=new Byte(a[1]);     //   Second input converted to integer
    for(;++i<6;               //   Loop (1) from 1 to 6 (inclusive)
        r+="\n")              //     After every iteration: Append a new-line to the result
      for(j=0;++j<6;          //    Inner loop (2) from 1 to 6 (inclusive)
        r+=6-i==y             //     If the second input equals `6-1`,
           &j==z?             //     and the first input equals `j`:
            a[2]              //      Append the third input to the result-String
           :                  //     Else:
            0                 //      Append a zero to the result-String
      );                      //    End of inner loop (2)
                              //   End of inner loop (1) (implicit / single-line body)
    System.out.print(         //   Print:
     z>0&z<7&y>0&y<7?         //    If the coordinates are valid (1-6):
      r                       //     Print the result `r`
     :                        //    Else:
      0);                     //     Print 0 as error instead
  }                           //  End of main-method
}                             // End of class
```
]