Thread: chat simulation

  1. #16
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    If you're going to program C, you're going to need them.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  2. #17
    wise_ron wise_ron's Avatar
    Join Date
    May 2006
    Posts
    75

    Smile why i dont want to use pointers.

    The reason why i dont want to use pointers is because i have to do the program in a programming language called baci which is similar to c but is not c. It would be like c --, i figure out if i learn in c baci will be like a pice of cake.
    Wise_ron
    One man's constant is another man's variable

  3. #18
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    And they don't have pointers in baci? Wow...
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #19
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Ok, well look, this is a C forum. Not a baci forum. I can help you with C related stuff, and not baci (as I don't know this language and have no intention of learning it), and it's likely to be the same for all the other members.

    So my best advice to you is to find some equivalent to pointers in baci...because C would be pretty lame if it didn't have pointers...
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  5. #20
    wise_ron wise_ron's Avatar
    Join Date
    May 2006
    Posts
    75

    Whats wrong with this.

    Can some one help me with this c programming code. Iam trying to pass the character array string from sever fuction to client function.

    Code:
    #include<stdio.h>
    main()
    {
    	server();
    	client();
    	return 0;
    }
    
    void server(void)
    	{
    		char client1[]= "Hello"; //message from the server
    	}	
    
    void client(void)		
    	{
    		
    		int i=1;
    		
    		printf("client 1  sends: %s\n", client1);
    		for(i=2; i<10;i++) 
    		printf("client %d receives: %s\n", i, client1);
    	}
    Wise_ron
    One man's constant is another man's variable

  6. #21
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    The scope of client1 is within the server function, therefore no other parts of your code can see it.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  7. #22
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    This:
    Code:
    int i = 1;
    ...
    for (i = 2; i < 10; i++)
    Could be more efficiently done as:
    Code:
    int i = 2;
    ...
    for (i; i < 10; i++)
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  8. #23
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Or even more efficiently as
    Code:
    int i = 2;
    ...
    for ( ; i < 10; i++)
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with time simulation assignment
    By rakan in forum C++ Programming
    Replies: 3
    Last Post: 10-31-2006, 11:39 AM
  2. Requesting Java Chat Client Maintenence
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 04-02-2003, 01:57 PM
  3. Chat server/client trial -- anyone interested?
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-23-2003, 10:47 PM
  4. SO close to finishing chat program...!
    By Nakeerb in forum C++ Programming
    Replies: 13
    Last Post: 10-26-2002, 12:24 PM
  5. Rough Portable Chat Design Sketch
    By ggs in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-27-2001, 07:44 AM