Please, help me.

Joined
Aug 15, 2023
Messages
1
Reaction score
0
For some reason that i don't know my program is ignoring this line of my code:

for(n=0;n++;){
printf("%s",&contatosnovos[n].nome);
}

This isn't even the main problem. This is just a change I just made to find what's happening. The real matter is: I'm trying to walk through an array and verify if there's something written at that location. However the program just gets out of the loop before it reachs a location that is supposed to be empty. Here's how it was originally written:

for(n=0;contatosnovos[n].nome!=0;n++;){
cont++;
}

But it doesn't matter what i do. The program refuses to keep on the loop. It just happens in this specif line even though my code has similar lines in which it doesn't happe. Any ideas?
 
Joined
Aug 6, 2023
Messages
5
Reaction score
0
Is n declared? For your second try, the middle constraint isn't set properly, maybe an additional semicolon would help.

Edit: nome is supposed to be different than zero.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top