#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Help!!!!!! help me break the loop........


    now i writing a program to count the num for a person"lila"enter the gate ,other just simply print welcome.so this my code but i dun know how to break the loop .pls help!

    Code:
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    
    int main()
    {
    	int i,count;
    	char name[500];
    	printf("please enter you name:\n");
    	scanf("%s",name);
    
    	if(strcmp(name,"lila")==0)
    	{
    		 for(i = 1; i <= count; i = i + 1){
             printf("number of enter=%d", i);
    	
    		}
    		return;
    		
    	}
    	else
    	{
    		printf("welcome\n");
            return 0; 
    	}
    	
    }
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,413
    Rep Power
    1871
    Please edit your post, and place [code][/code] tags around your code.

    Nevermind - yet another impatient cross-poster
    Last edited by salem; December 27th, 2012 at 04:37 AM.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    You have to initialize "count". It needs a value.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    86
    Rep Power
    0
    Originally Posted by freakyboard
    You have to initialize "count". It needs a value.
    used goto or condition to stop the program

IMN logo majestic logo threadwatch logo seochat tools logo