Can you pass a char* to a function that takes const char *s ?

This is a discussion on Can you pass a char* to a function that takes const char *s ? within the C Programming forums, part of the General Programming Boards category; or does it cause undefined behavior?...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    98

    Can you pass a char* to a function that takes const char *s ?

    or does it cause undefined behavior?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    it is perfectly acceptable. You can always add const-ness

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  2. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  3. The Interactive Animation - my first released C program
    By ulillillia in forum A Brief History of Cprogramming.com
    Replies: 48
    Last Post: 05-10-2007, 03:25 AM
  4. Replies: 7
    Last Post: 06-16-2006, 10:23 PM
  5. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21