help me

how to fix this when i run the program and enter my name then output my name in vertical position using the for loop and press enter the program do not stop plsss help me this is my codes for this program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
#include<conio.h>
#include<dos.h>
main()
{
char name,n;
clrscr();
	printf("Enter Your Name:");
	scanf("%c",&name);

	for(n=name;n=name;n++){

	delay(1000);

	printf("\n%c",name);
	scanf("%c",&name);
	}
getch();
}
Last edited on
Firstly, when you post code, please enclose it code tags to make it easier to read. See http://www.cplusplus.com/articles/z13hAqkS/ . If you can edit your original post to use the tags, that would help make your code more readable.

Your for loop makes no sense at all. Firstly, why are you even looping? You've declared name to be a single character, so what is there to loop over?

Each time you iterate over the loop, you increment n, but then in your loop test condition, you set n to be equal to name again.

I suggest you read up on how for loops work, to get a better understanding.
what is the wrong in my code plsss help me
Um... I explained it to you. Your for loop is messed up.
Topic archived. No new replies allowed.