Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Char variable for each for loop

Status
Not open for further replies.

zenniz

Junior Member level 3
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:

if SPACE is char then why assign "XX" ?!

what datatype is A? It will rarely 'equal' 1 or 0
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top