Jul 24, 2013 #1 Z zenniz Junior Member level 3 Joined Mar 25, 2013 Messages 29 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Location Singapore Visit site Activity points 1,497 I'm trying to write simplified program char SPACE has no fix byte Variable A is a random value of 1 and 0 If A = 0, SPACE = 'XX' If A = 1, SPACE = 'Y' I'm trying to assign one SPACE char variable for each loop int i value Code: char *space ???? for(int i; i = 0; i++) { if(A == 1) { ???? = "XX" } else { ???? = "Y" } } printf("%s %s %s %s", ???????); For example if int 0, A = 1 int 1, A = 1 int 2, A = 0 int 3, A = 1 The end result will be "Y Y XX Y" Last edited: Jul 24, 2013
I'm trying to write simplified program char SPACE has no fix byte Variable A is a random value of 1 and 0 If A = 0, SPACE = 'XX' If A = 1, SPACE = 'Y' I'm trying to assign one SPACE char variable for each loop int i value Code: char *space ???? for(int i; i = 0; i++) { if(A == 1) { ???? = "XX" } else { ???? = "Y" } } printf("%s %s %s %s", ???????); For example if int 0, A = 1 int 1, A = 1 int 2, A = 0 int 3, A = 1 The end result will be "Y Y XX Y"
Jul 24, 2013 #2 kam1787 Advanced Member level 3 Joined Jul 5, 2010 Messages 926 Helped 167 Reputation 340 Reaction score 168 Trophy points 1,323 Location English Visit site Activity points 5,825 if SPACE is char then why assign "XX" ?! what datatype is A? It will rarely 'equal' 1 or 0