Thread: embeding strcat in a call to my own function

  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    808

    embeding strcat in a call to my own function

    i have a call to one of my own functions that needs two strings to be joined together ie
    Code:
    update_board_array(board, strcat(escape_code, COLOUR_BLACK_PIECE), x ,y);
    instead of
    Code:
    strcat(escape_code, COLOUR_BLACK_PIECE)
    update_board_array(board, escape_code,  x ,y);
    is it ok to do the former or should i stick the the second example
    coop

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    And how does escape_code get back to being it's ordinary self, so you can do say
    strcat(escape_code, COLOUR_WHITE_PIECE)

    You should avoid unnecessarily compressing statements together.
    Leave the micro-optimisations to the compiler.

    Keep things simple, so it's easy to read / modify / debug.
    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.

  3. #3
    Registered User
    Join Date
    Apr 2019
    Posts
    808
    ok thanks does that go for the ? : thingy ma jig as well.... should i be using if else statements?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function call Overhead and Function Call Stack
    By Alam Khan in forum C++ Programming
    Replies: 2
    Last Post: 04-26-2014, 08:28 AM
  2. How does the function strcat use?
    By zcrself in forum C Programming
    Replies: 10
    Last Post: 08-14-2009, 12:53 AM
  3. my strcat function
    By kurz7 in forum C Programming
    Replies: 2
    Last Post: 05-06-2003, 03:00 AM
  4. Embeding C++ in Visual Basic
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 07-02-2002, 08:13 PM
  5. strcat function
    By Peachy in forum C Programming
    Replies: 1
    Last Post: 09-23-2001, 07:04 PM

Tags for this Thread