Thread: Not populating a string

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    Code:
    int main(void)
    {
    	
    	double f;
    	memset(&f,0,sizeof(f));
    	
    	printf("%f\n",f);
    	
    	char *p;
    	memset(&p,0,sizeof(*p));
    	
    	if(p == NULL) {
    		printf("ok null\n");
    	} else {
    		printf("nonoob is real noob\n");
    	}
    	
    return 0;
    }
    
    0.000000
    nonoob is real noob
    http://c-faq.com/null/machnon0.html
    http://c-faq.com/~scs/cgi-bin/faqcat...=malloc#calloc
    Last edited by Bayint Naung; 06-03-2011 at 12:24 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. populating 2-D array
    By edster in forum C Programming
    Replies: 4
    Last Post: 10-22-2009, 02:42 PM
  2. Populating a Struct
    By larry_2k4 in forum C Programming
    Replies: 4
    Last Post: 10-21-2009, 09:27 PM
  3. populating arrays
    By jafa401 in forum C Programming
    Replies: 12
    Last Post: 08-04-2009, 11:22 PM
  4. populating a string only alpha characters
    By MSF1981 in forum C Programming
    Replies: 10
    Last Post: 02-06-2009, 10:58 AM
  5. populating arrays
    By john_murphy69 in forum C Programming
    Replies: 7
    Last Post: 04-04-2003, 12:03 PM